j-d-carmichael / boats

Beautiful Open Api Template System
MIT License
57 stars 8 forks source link

OpenAPI 3.1 Support #63

Closed TomFreeman closed 2 years ago

TomFreeman commented 3 years ago

Is your feature request related to a problem? Please describe. Boats currently doesn't support OpenAPI 3.1 specs. Tracking any work required to support the latest spec.

Describe the solution you'd like We're blocked by swagger-parser, which currently doesn't support OpenAPI 3.1, but other blockers I'm not aware of may exist.

Describe alternatives you've considered Replace swagger-parser altogether, which seems overly intrusive. Enable a command line flag that skips the use of swagger-parser for 3.1 specs, this sacrifices value.

Additional context Thought I'd start tracking the dependencies needed to make OpenAPI 3.1 work here, specifically the webhooks feature would be useful for our use-case.

p-mcgowan commented 3 years ago

I wonder if some kind of bridge / adaptor solution might work in the interrim? Something that could check if it's 3.1, convert to 3.0 removing certain functioanlity, then running it through swagger parser and manually adding back in the extra features? That might provide a stop-gap until the new spec is supported, but I'm not sure exactly which features are missing and if that's just way too much effort / overhead? Just spitballing here.

j-d-carmichael commented 3 years ago

https://github.com/APIDevTools/swagger-parser/issues/169

Seems this is on the radar

j-d-carmichael commented 3 years ago

I don't think it would be time well spent building in a 3.1 -> 3.0 downgrader to bypass the swagger parser block.

Putting in a flag to skip validation would bypass would work until there is support for OA 3.1 validator - not seeing one on the listed tools yet from here: https://openapi.tools/#parsers

j-d-carmichael commented 3 years ago

WIP: https://github.com/liffery-com/boats/pull/64

For some reason my local machine hits errors now with this new code - but it make no sense. This issue seems related, https://github.com/APIDevTools/json-schema-ref-parser/issues/14#issuecomment-698530729

Will try and pick this up again later unless anyone else gets it working before me :)

p-mcgowan commented 3 years ago

I won't look at it this weekend but if you havn't figured it out by next week i might end up taking a look. Odd error for sure

j-d-carmichael commented 3 years ago

Looks like https://stoplight.io/open-source/spectral/ offers 3.1 support on the validation, not tried it yet but might be worth swapping out swagger-parser in favour

if those screen shots are true, the error looks easy on the eye too

j-d-carmichael commented 2 years ago

@TomFreeman appologies for the delay on this one, the latest release has a new cli flag to skip validation.

j-d-carmichael commented 2 years ago

@TomFreeman https://github.com/APIDevTools/swagger-parser/pull/187 and this should now be in the latest version of boats

TomFreeman commented 2 years ago

Amazing! No need to apologise, I've had my head elsewhere recently too.