unioslo / harborapi

Python async client for the Harbor REST API v2.0.
https://unioslo.github.io/harborapi/
MIT License
28 stars 6 forks source link

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

Closed pederhan closed 11 months ago

pederhan commented 1 year ago

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.