Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: OpenAPI 3.1 support, fixes #115 #145

Merged
merged 8 commits into from
Dec 5, 2022
Merged

feat!: OpenAPI 3.1 support, fixes #115 #145

merged 8 commits into from
Dec 5, 2022

Conversation

danielgtaylor
Copy link
Owner

@danielgtaylor danielgtaylor commented Dec 1, 2022

This PR implements OpenAPI 3.1 support by switching to https://github.com/pb33f/libopenapi as the underlying Golang OpenAPI library. Every effort is being made to make this a backward-compatible change, however it's possible something may break or change slightly. Included with this change are:

  • Some improvements to example generation
  • Grouping of responses with the same model (commonly found in error responses)
  • Improved test coverage
  • Basic support for allOf, anyOf, oneOf

Related upstream issues:

@codecov
Copy link

codecov bot commented Dec 1, 2022

Codecov Report

Merging #145 (c59001f) into main (e73c737) will increase coverage by 7.55%.
The diff coverage is 92.26%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #145      +/-   ##
==========================================
+ Coverage   66.22%   73.78%   +7.55%     
==========================================
  Files          22       22              
  Lines        2594     2823     +229     
==========================================
+ Hits         1718     2083     +365     
+ Misses        698      583     -115     
+ Partials      178      157      -21     
Impacted Files Coverage Δ
cli/apiconfig.go 81.48% <ø> (ø)
cli/content.go 73.48% <0.00%> (-2.30%) ⬇️
cli/lexer.go 69.10% <0.00%> (-3.55%) ⬇️
cli/operation.go 77.77% <ø> (ø)
cli/param.go 88.31% <ø> (ø)
cli/api.go 49.59% <75.00%> (+<0.01%) ⬆️
openapi/openapi.go 88.91% <90.15%> (+36.43%) ⬆️
openapi/example.go 98.63% <98.54%> (+98.63%) ⬆️
cli/formatter.go 88.94% <100.00%> (ø)
openapi/schema.go 98.46% <100.00%> (+6.89%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e73c737...c59001f. Read the comment docs.

@danielgtaylor danielgtaylor added enhancement New feature or request dependency Issue is upstream in a dependency library labels Dec 1, 2022
@danielgtaylor danielgtaylor marked this pull request as ready for review December 5, 2022 04:54
@danielgtaylor danielgtaylor merged commit c145bbb into main Dec 5, 2022
@danielgtaylor danielgtaylor deleted the openapi31 branch December 5, 2022 05:50
@wdullaer
Copy link
Contributor

wdullaer commented Dec 6, 2022

This library returns errors for circular references here:

result, errs := doc.BuildV3Model()

Restish then proceeds to panic on these.

Unfortunately this breaks restish for all our APIs :-(

Looking at the libopenapi source code, it seems like the circular reference errors can be detected with errors.Is. I would have to assess the impact on example generation.

@waldyrious
Copy link
Contributor

For future reference, @wdullaer's comment above was addressed in pb33f/libopenapi#39 and then in #151, which has now been released in https://github.com/danielgtaylor/restish/releases/tag/v0.15.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Issue is upstream in a dependency library enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants