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

Is there a way to generate openapi v3? #76

Open
SVilgelm opened this issue Oct 14, 2021 · 9 comments
Open

Is there a way to generate openapi v3? #76

SVilgelm opened this issue Oct 14, 2021 · 9 comments

Comments

@SVilgelm
Copy link
Contributor

I see that this projects heavily uses Swagger v2, but is there a way to generate v3? Maybe you can recommend a project that we can use instead of go-restful-openapi but which works with go-restful?

@emicklei
Copy link
Owner

hi, I am not aware of other projects that can generate a v3 document with data available in go-restful.

With contributors , we can start creating a v3 branch in this project and modify the code such it is conform the v3 spec.

@SVilgelm
Copy link
Contributor Author

ok, thank you!
I think it would be better to create another project to keep v2 available for other

@emicklei
Copy link
Owner

@SVilgelm I can think of a couple of reasons to introduce v3 branch instead:

  • package name go-restful-openapi does not change ; devs won't leave the project
  • maintaining code is easier, a fix in v2 can be cherry picked into v3
  • v3 branch changes does not affect master or v2.

@SVilgelm
Copy link
Contributor Author

I did some research and seems only this https://github.com/getkin/kin-openapi/tree/master/openapi3 project is alive, so v3 branch will require to use kin lib instead of swagger
Is it OK?

I'm not sure how good the https://github.com/getkin/kin-openapi/tree/master/openapi2, but maybe it worth to use it instead of swagger as well for v2?

@SVilgelm
Copy link
Contributor Author

forget about my last suggestion about using kin for v2, it will break existent code for all users for sure

@emicklei
Copy link
Owner

so kin for v3 is still a reasonable choice?

@SVilgelm
Copy link
Contributor Author

SVilgelm commented Jun 2, 2022

it is up to you, but seems it supports v3 pretty well. I have created my own lib for v3.1, but it depends on go v1.18, because of generics: https://github.com/sv-tools/openapi

@EvenChang
Copy link

I'm confusing...
How can I use go-restful-openapi to generate openAPI v3 ?

@SVilgelm
Copy link
Contributor Author

it is not supported yet, I used kin-openapi to convert v2 to v3, worked well, with some hacks of course. It really depends what you want from the v3 API. If you need just some basic features, that are supported by v2, then kin library will work for you, but if you need something like oneOf, then you will need to modify the v3 spec after the conversion.

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

No branches or pull requests

3 participants