Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with optional strings #185

Open
neilsouth opened this issue Jan 11, 2021 · 0 comments
Open

Problem with optional strings #185

neilsouth opened this issue Jan 11, 2021 · 0 comments

Comments

@neilsouth
Copy link

neilsouth commented Jan 11, 2021

Forgive me if Ive missed something but I have the following simple swagger

paths:
  /string:
    post:
      parameters:
        - name: stringBody
          in: body
          schema:
            $ref: "#/definitions/StringBody"
          required: true
      responses:
        200:
          description: All good

definitions:
  StringBody:
    type: object
    properties:
      stringBody:
        type: string
        maxLength: 13

I want Joi to have the .allow('') option on the payload of stringBody, but I cannot find a way to set this ?
so now if I curl with
curl localhost:8083/v2/string -H "Content-Type: application/json" -d '{"stringBody":""}'
I get
{"statusCode":400,"error":"Bad Request","message":"Invalid request payload input"}

it would be good to have some global option to set this for all string inputs, have I missed something ?

cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant