Closed JayPe69 closed 3 weeks ago
Hi,
thanks for asking. fastify-openapi-glue
takes the OpenAPI schema, then tries to parse it en feeds the result to Fastify
as configuration. Fastify then uses that configuration to validate any requests. Request validation in Fastify is handled by AJV (see https://github.com/fastify/fastify/blob/main/docs/Reference/Validation-and-Serialization.md).
Digging a bit deeper I found that AJV does not support "discriminator" out of the box (see https://ajv.js.org/json-schema.html#discriminator).
You then have two options: a) remove the "discriminator" keyword from the schema b) add the "discriminator: true" to the AJV options (e.g. see https://fastify.dev/docs/latest/Reference/Server/#factory-ajv)
Hope this helps! Kind regards, Hans
Hi @seriousme ,
Thanks a lot.
Well it seems discriminator will be deprecated in the version 4 of OpenAPI. With AJV, even by activating discriminator, mapping is not supported.
Thanks for your help and support
Hello,
I'm trying to add a discriminator the my api schema. The swagger editor does not show me any error, but openapiglue does not seem to work with it :
requestBody sample :
Documentation : https://swagger.io/docs/specification/v3_0/data-models/inheritance-and-polymorphism/#discriminator
Any tips ? Thank you