question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request : add parameter for AJV removeAdditionnal

See original GitHub issue

I’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:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
seriousmecommented, Jan 31, 2020

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.

1reaction
seriousmecommented, Jan 30, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found