Request : add parameter for AJV removeAdditionnal
See original GitHub issueI’m using fastify-openapi-glue on several projects and i faced an issue regarding additionnalProperties:false
. Because of this line : https://github.com/seriousme/fastify-openapi-glue/blob/master/index.js#L53
Is it possible to add a parameter for this? This would lead in a HTTP 400
is there is additionnal properties.
I can write a PR for this.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Ajv options - Ajv JSON schema validator
removeAdditional ; useDefaults; coerceTypes ... By default methods compile and validate add schemas to the instance if they have $id (or id )...
Read more >removeAdditional not work with allOf · Issue #1231 - GitHub
want to accomplish following requirements with ajv: validate data with schema; drop additional properties not provided in schema.
Read more >how to remove non-schema params from the query
With removeAdditional: true you must still set additionalProperties: false on your schema: querystring: { type: "object", properties: { … } ...
Read more >Validation-and-Serialization - Fastify
Validation will only be attempted if the content type is application-json , as described ... allErrors: true }), params: new Ajv({ removeAdditional: false, ......
Read more >Validation & Sanitization - FoalTS
They are particularly useful for checking and transforming parts of HTTP requests (such as the body). With a JSON Schema (AJV). Ajv, the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I checked ajv-oai and I think it would be fairly straight forward to have it provide a AJV plugin as well so I submitted an issue (https://github.com/amazing-gao/ajv-oai/issues/6)
If that works out then I can simplify my code as well and can provide you (and others 😃) with transparant access to Fastify’s ajv flags.
Ok, I see the use case and I have a working prototype. I’m going to check if I can mimick the exact behavior of the fastify ajv parameter.
Kind regards, Hans