cdimascio / express-openapi-validator

🦋 Auto-validates api requests, responses, and securities using ExpressJS and an OpenAPI 3.x specification
MIT License
920 stars 211 forks source link

Setting nullable breaks minLength validation #912

Open sepek opened 7 months ago

sepek commented 7 months ago

Describe the bug When setting nullable and minLength for a string and sending a request which does not fullfil the minLength makes the request hang

To Reproduce Just try the request again which does not fullfil the minLength

Actual behavior E.g. curl simply hangs until timeout

Expected behavior Express should respond that the request doesn't fullfil the requirements.

Examples and context Having a model including a requestBody for POST containing something like that:

    UserPassword:
      type: string
      minLength: 8
      maxLength: 128
      nullable: true
      default: null
      description: Foo
      example: Bar

will make Express hang if a string is provided in a request which is smaller than minLength.