Skip to content

Instantly share code, notes, and snippets.

@serjflint
Created October 29, 2023 18:22
Show Gist options
  • Save serjflint/4a2aba8c6484232ab0b96c900bfafe27 to your computer and use it in GitHub Desktop.
Save serjflint/4a2aba8c6484232ab0b96c900bfafe27 to your computer and use it in GitHub Desktop.
datamodel-code-generator params
python3.11 -m datamodel_code_generator --input=path/to/openapi.json \
--input-file-type=openapi --output-model-type=pydantic_v2.BaseModel \
--output=path/to/genearated.py \
--use-annotated --strict-nullable --use-standard-collections \
--use-generic-container-types --use-union-operator \
--use-schema-description --use-field-description \
--reuse-model --use-operation-id-as-name \
--target-python-version=3.11 --validation --openapi-scopes paths schemas parameters \
--enum-field-as-literal all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment