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

Harbor API schema requires datamodel-code-generator<=0.13.0 #54

Closed
pederhan opened this issue May 31, 2023 · 0 comments · Fixed by #60
Closed

Harbor API schema requires datamodel-code-generator<=0.13.0 #54

pederhan opened this issue May 31, 2023 · 0 comments · Fixed by #60
Labels
API Spec Errors or inconsistencies in the API spec

Comments

@pederhan
Copy link
Member

pederhan commented May 31, 2023

datamodel-code-generator fails to generate models from the official Harbor Swagger 2 API schema starting from version 0.13.5. datamodel-code-generator does not officially support OpenAPI 2 (a.k.a. swagger): koxudaxi/datamodel-code-generator#895

Manually converting the schema to OpenAPI 3 via https://editor.swagger.io/ resolves the issue for >=0.13.5, but I have not found a way to do this programmatically yet (have not looked too hard).

Ultimately, we either have to lock into datamodel-code-generator==0.13.0 as long as the Harbor spec stays on OpenAPI 2, or we have to find an easy (and automatable) way to convert the schema to OpenAPI 3 when we generate models. Having to download the schema, paste it into the Swagger Editor, download it to the correct directory, then running the just genapi command is very cumbersome, and I would like to avoid that if possible.

@pederhan pederhan added the API Spec Errors or inconsistencies in the API spec label May 31, 2023
@pederhan pederhan changed the title Harbor API schema needs to be converted to OpenAPI 3 when generating models Harbor API schema requires datamodel-code-generator<=0.13.0 Jun 7, 2023
@pederhan pederhan linked a pull request Oct 13, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Spec Errors or inconsistencies in the API spec
Projects
None yet
1 participant