community-phone-company / shipbob-sdk-python

A library to interface with ShipBob API
MIT License
3 stars 2 forks source link

Generate code automatically from Shipbob's published swagger specification #3

Open lullis opened 1 year ago

lullis commented 1 year ago

Shipbob's Developer Site provides the OpenAPI specification from their API, which could be used to generate all the pydantic model types that we need by levaraging the datamodel-code-generator.

However, it seems that the published spec from them fails to work with the codegen tools. It would be nice to either fix the spec to make it work with the tools, or work with Shipbob upstream to get their spec fixed.

antxln commented 1 year ago

The issue seems to be with codegen. After making this change, https://github.com/koxudaxi/datamodel-code-generator/commit/df88011f22487c07231b423cefd13aef6d7a5bb6, I was able to generate the datamodels with

datamodel-codegen --input openapi.json --input-file-type openapi --output model