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

Schema validation #506

Closed
shayff opened this issue Aug 17, 2023 · 2 comments · Fixed by #507
Closed

Schema validation #506

shayff opened this issue Aug 17, 2023 · 2 comments · Fixed by #507

Comments

@shayff
Copy link

shayff commented Aug 17, 2023

I'm not sure if this question related to the plugin or the fastify itself.
I have the following example:
{ "in": "formData", "name": "name", "type": "string", "required": true, "maxLength": 30, },

I see that I did get validation for the property and the type but not for the maxLength, any reason why?

@seriousme
Copy link
Owner

Hi,

thanks for asking !

As OpenApi V3 does not have a "formData" parameter I presume you are using V2.

Looking at the specification of the parameter object in V2 . Looking at https://spec.openapis.org/oas/v2.0#parameter-object I noticed that the current V2 parser implementation is missing the fields listed under:
If [in](https://spec.openapis.org/oas/v2.0#parameterIn) is any value other than "body":

In V3 this problem does not occur as the schema items are all listed under a schema property.
https://spec.openapis.org/oas/v3.1.0#parameter-object

So my first advice would be to migrate your spec to V3.x as this will make it also more future proof ;-)

In the meantime I will try to add the missing fields to the V2 parser.

Hope this helps !
Hans

@seriousme
Copy link
Owner

Released as 4.3.2 on NPM.
Hope this helps !
Please reopen the issue if it doesn't work for you !
(Github autocloses an issue when its mentioned in a PR that is merged)

Kind regards,
Hans

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

Successfully merging a pull request may close this issue.

2 participants