We have some Pydantic data models , that we need t...
# general
f
We have some Pydantic data models , that we need to code generate to
jsonschema
- (openapi) The "generation" is as simple as
Copy code
from pydantic import Basemodel
...

class MyPydanticModel(BaseModel):
    ...

print(json.dumps(MyPydanticModel.schema(),indent=2))
I am happy plugging my way through writing a codegen plugin for this, but was wondering if I am able to leverage the openapi source types that exists already (for linting a openapi_document, etc) just after some guidance really. and once compete, I am happy to submit this plugin
b
If you're happy to use a pre-release, pants 2.16 contains a bunch of new target types that allow you to avoid writing a plugin. For instance, https://github.com/pantsbuild/example-adhoc/blob/main/openapi/BUILD uses
adhoc_tool
to export an OpenAPI schema from a flask app and the do some other code generation based on that... I don't know if these can hook into the
openapi_document
support; maybe @ancient-vegetable-10556 can assist.
f
ah actually yes that is all we will need I think.
perfect.
🎉 1
a
Just to follow on: they currently don’t hook into
openapi_document
, but probably could with a bit of work.