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

Can swagger2openapi convert from openapi3 to openapi2/swagger2? #58

Closed
stianlagstad opened this issue Mar 7, 2018 · 5 comments
Closed

Comments

@stianlagstad
Copy link

Sorry if this is off-topic. I would like to use swagger-codegen to create a simple SDK for an API that's documented with openapi3. But since swagger-codegen isn't quite there yet for openapi3, I'm looking for a way to convert our openapi3 spec to openapi2. Is that possible to do with swagger2openapi?

@stianlagstad
Copy link
Author

stianlagstad commented Mar 7, 2018

I found a converter that might do the trick: api-spec-converter.

➜ api-spec-converter http://doc.cognitedata.com/openapi.json --from=openapi_3 --to=swagger_2 --syntax=yaml > swagger2.yaml
unsupported request body media type tagMatching { '*/*': { schema: { '$ref': '#/components/schemas/TagMatchingInput' } } }
unsupported request body media type postNewModel { '*/*': { schema: { '$ref': '#/components/schemas/3D Model' } } }
unsupported request body media type postNewRevisionJob { '*/*': { schema: { '$ref': '#/components/schemas/File Id Body' } } }

I'm going to test it with swagger-codegen and see how it goes.

@MikeRalphson
Copy link
Contributor

openapi-codegen uses the same downconverter as api-spec-converter internally, so might also work for you.

@stianlagstad
Copy link
Author

Thanks Mike!

@utx0
Copy link

utx0 commented Mar 3, 2019

Hey @stianlagstad, I have been thinking about doing something very similar and would really love to hear about your experience in using a OSA3 to 2 downgrade process and what pros and cons you hit up against? The project I'm working on we are looking at using golang for our api development however the best pkg out there is go-swagger and its only v2 at this point.

Any info would be greatly appreciated. Thanks!

@stianlagstad
Copy link
Author

@lukekhamilton Not much to tell, I'm afraid. We only did a couple of tests using it and have so far decided against generating our SDK code from specs.

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