python-openapi/openapi-schema-validator

minLength error message is missing the path/field that is in error.

f-unk opened this issue · 1 comments

f-unk commented

Given the following OpenAPI schema:

model:
      required:
        - email
      type: object
      properties:
        email:
          type: string
          description: Email address of the user
          example: myname@mymail.com
          minLength: 1

And given the following input payload to validate against:

{"email": ""}

The message returned in the ValidationError looks like:

"'' is too short"

As you can see, it is missing the field or path that is in error.

P.S.: Thank you for the work on this package. It is very helpful. Any chance we can get multiple errors returned at the same time? :)

Thank you again.

f-unk commented

After more time playing with this I believe I was in error. The error message was displaying the value entered by the user and not the field in error and since the value was blank the message being displayed contained a blank value. This is probably how json validator does it at the end of the day.

Sorry for the misunderstanding.