You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched for a similar discussion without match. Please excuse me if it's a duplicate.
I'm trying to generate custom code, out of pydantic. I first attempted to generate java pojo.
I've gone through the doc. I managed to use $ datamodel-codegen --input {your_input_file} --output {your_output_file} --custom-template-dir {your_custom_template_directory}.
But it seems to lack some flexibility :
the structure of the template folder is hardcoded and a consequence of the limited list of model types : --output-model-type {pydantic.BaseModel,pydantic_v2.BaseModel,dataclasses.dataclass,typing.TypedDict,msgspec.Struct}.
the header of the document - list of imports - can not be changed (and seems to depends on the "model type").
it is not possible to generate one file per class, only one file containing all class
Is there a way to generate code out of python+pydantic ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I searched for a similar discussion without match. Please excuse me if it's a duplicate.
I'm trying to generate custom code, out of pydantic. I first attempted to generate java pojo.
I've gone through the doc. I managed to use
$ datamodel-codegen --input {your_input_file} --output {your_output_file} --custom-template-dir {your_custom_template_directory}
.But it seems to lack some flexibility :
--output-model-type {pydantic.BaseModel,pydantic_v2.BaseModel,dataclasses.dataclass,typing.TypedDict,msgspec.Struct}
.Is there a way to generate code out of python+pydantic ?
Cheers
Beta Was this translation helpful? Give feedback.
All reactions