express-openapi-validator
express-openapi-validator copied to clipboard
Support for OpenAPI 3.1.0
Hi, are there plans to support OpenAPI 3.1.0 with this library?
We're currently running into issues when validating the API spec because Stoplight API exports are using features exclusive to 3.1.0. Mainly trying to avoid workarounds where we manually downgrade the OA version and remove the said block post-export.
The specific feature being a change to the Schema definition to contain examples
components:
schemas:
User:
title: User
type: object
description: ''
examples:
- id: 0
firstName: Bob
lastName: Ross
email: [email protected]
emailVerified: true
createTime: '2019-08-24T12:42:12Z'
lastUpdateTime: '2020-09-23T08:17:41Z'
Thank you!
It seems they have done the work, but have not yet released it as an update: https://github.com/cdimascio/express-openapi-validator/pull/713
OpenAPI 3.1 support is blocked on AJV implementing it, even if this library updates: https://github.com/OAI/OpenAPI-Specification/issues/2689
@essential-randomness would it possible to have a version that works without $dynamicAnchor and $recursiveAnchor ?
With a big warning on the main page about this ?
I'm missing so much null type and unevaluatedProperties for composition with allOf.
Ah, man, I wish. There may be some movement on the AJV issue since yesterday, and if I understand correctly they offered a bounty. As far as my exploration went, I don't think it's possible to do anything about this without the AJV issue being resolved.
@essential-randomness sorry, I didn't dig into the implication of $dynamicAnchor and $recursiveAnchor. I was just hoping it was ad hoc features... And yes, I saw this 500-1000$ bounty. Hopefully it will create some movement around this AJV issue. It is so sad, OpenApi 3.1 has exactly all the features needed to do good composition and type validation.
@essential-randomness I'm really curious, it seems that fastify-openapi-glue succeed to have the openapi 3.1.0 specification working: https://github.com/seriousme/fastify-openapi-glue/issues/178
To be honest I didn't test it but according to some colleagues, it works well. Maybe they found a valid workaround.
From there:
 3.1, by converting $dynamicRef and $dynamicAnchor into $ref and $anchor for now. This might cause some limitations for now but I think thats worth it.
I have no idea of the implications of this, nor would know what this conversion entails, but this is how they seem to be doing it.
Still nothing?
It would be cool to have features like unevaluatedProperties from draft 2019-9. I tried to change the draft, but I may need to spend more time if nothing happens on this issue.
@cdimascio Is this update on the roadmap?
I think this is a duplicate of this issue.
As I posted about on the above issue, is it possible for this library to take on the preprocess step to resolve $dynamicRef before calling out to AJV? If not, would it be possible to provide a solid reason why it belongs in AJV to respond and continue pushing this forward?
This is a duplicate of https://github.com/cdimascio/express-openapi-validator/issues/573