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 v3.0 support #805

Merged
merged 4 commits into from
Jun 17, 2023
Merged

feat: OpenAPI v3.0 support #805

merged 4 commits into from
Jun 17, 2023

Conversation

Marsup
Copy link
Contributor

@Marsup Marsup commented Jun 9, 2023

Hi,

I've implemented basic OpenAPI v3.0 spec output with the additional support for anyOf and nullable in JSON schemas.

I started without knowing Swagger 2.0, OpenAPI 3.0, or this module at all, so there may be mistakes, but it seems to pass validators. I'm pretty sure I didn't implement the full spec, but it seems to work on all the test servers and on our own real-world server, so I think it's already a good starting point.

I tried to reuse most of the existing code whenever possible, but working with the code base seemed a bit tedious at the end. I feel like this may need a deeper rewrite, but I didn't have the resources nor did I feel entitled to do that in a feature PR, so I hope the way I did it won't bother you too much. Tests are sometimes adapted, sometimes full copies of existing ones with the 3.0 twist when it would introduce too many conditionals, it feels more maintainable that way, but one has to implement new tests in both files in the future, unfortunately. This may be possible with a lot of abstracted test helpers.

@robmcguinness
Copy link
Collaborator

@Marsup Thank you for PR. I will be reviewing shortly. I agree with all your points.

@Marsup
Copy link
Contributor Author

Marsup commented Jun 12, 2023

Thanks a lot Rob. For the record, I'm still ironing out some quirks I find now that I'm integrating it into other tools, but it's stable enough.

@robmcguinness robmcguinness merged commit 2c5e275 into hapi-swagger:master Jun 17, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants