Skip to content

build(deps-dev): bump datamodel-code-generator from 0.31.2 to 0.84.0 in /sdk/python - #959

Closed
dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/pip/sdk/python/datamodel-code-generator-0.84.0
Closed

dependabot[bot] wants to merge 1 commit into
mainfrom
dependabot/pip/sdk/python/datamodel-code-generator-0.84.0

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Oct 19, 2026

Copy link
Copy Markdown

Bumps datamodel-code-generator from 0.31.2 to 0.84.0.

Release notes

Sourced from datamodel-code-generator's releases.

0.84.0

Highlights

Experimental: FastAPI server and Python client generation

Besides the models, datamodel-code-generator can now generate a FastAPI server package and a typed HTTPX2 client from one OpenAPI document. Both are new in 0.84.0 and experimental: options, templates and the generated packages may change in later releases (they are listed in the experimental registry with since_version 0.84.0). The generated code uses your generated models as its runtime contract: they validate requests and responses, and the generated server reads its packaged copy of the OpenAPI document only to serve it.

Get started:

# FastAPI server package in app/server/ (mkdir app && touch app/__init__.py first)
datamodel-codegen \
  --input openapi.yaml \
  --input-file-type openapi \
  --openapi-scopes schemas api \
  --output-model-type pydantic_v2.BaseModel \
  --preset standard-py312-20260909 \
  --output app/models.py \
  --generate-server fastapi \
  --server-output app/server \
  --server-package app.server \
  --server-model-package app.models
HTTPX2 client package in app/client/
datamodel-codegen 
--input openapi.yaml 
--input-file-type openapi 
--openapi-scopes schemas api 
--output-model-type pydantic_v2.BaseModel 
--preset standard-py312-20260909 
--output app/models.py 
--generate-client httpx2 
--client-output app/client 
--client-package app.client 
--client-model-package app.models

  • --generate-server / --generate-client require --server-output / --client-output, --server-package / --client-package (the import path of the package) and --server-model-package / --client-model-package (the import path of the models). --output names the model file (models.py above), not a package. The other --server-* / --client-* options are in the CLI reference.
  • A client needs a base URL: an operation without servers in the document needs --client-default-base-url, otherwise generation stops with an error
  • --generate-server and --generate-client require an explicit --input-file-type openapi: an input type left to detection, auto, or any other type stops with Error: --generate-server requires --input-file-type openapi, not auto and exit code 2 before the input is read (#4639)
  • Every server and client setting is a CLI option, a [tool.datamodel-codegen] key, and a generate() option; both targets reuse the model output options (formatters, file header, line length, and so on) (#4401, #4406, #4430)
  • --check, --diff-against, --watch and --output-format json work as for models, and so do batch jobs (#4438, #4442, #4443, #4517)
  • Target files are written like model files: edited files are overwritten, nothing is ever deleted, and --check lists leftover files as EXTRA (#4167, #4456, #4461). A generation that leaves .py files it no longer generates in the package, such as the router module of a removed tag, names them in one LeftoverFilesWarning (#4626). The required runtime dependencies are printed as a uv add ... command instead of being written to a requirements file (#4166); datamodel-code-generator does not edit pyproject.toml. --output-format json reports the package and the same dependencies as target.package and target.dependencies (#4680). The line asks for pydantic>=2.14.0, as does the client README (#4601, #4651). An explicit --target-pydantic-version older than that minimum (2, 2.11 or 2.12) is refused with Error: and exit code 2 for a server, and for a client whose models use pydantic; leave it unset or use 2.14 (#4627). A warning is shown when an existing package directory shadows a generated module, for server and client packages and also for plain model output (#4470).
  • Python API: pass generate_server="fastapi" or generate_client="httpx2" (plus server_* / client_* options) to generate(); with output=None it returns GeneratedModules with every model and package file (#4507)
  • Errors and warnings from the targets are regular dcg errors and Python warnings (#4421, #4434, #4516)
  • Groups of untagged operations: operations without a tag form the group default on both targets: routers/default.py, DefaultService, create_app(default=...) and the --server-router-names key default on the server, client.default on the client. A tag that itself derives default is numbered apart in declaration order (default, default_1) the same way on both (#4608).
  • Form bodies follow one rule on both targets: a multipart member, declared, inherited through allOf, or typed by additionalProperties, whose type has no single scalar kind (an object, a mapping, an array of objects, a mixed enum, or a union such as Filter | string or string | string[]) travels as application/json parts, one per item only for an array, and the server validates it with the member's model type. A member with a scalar kind travels as text, one value per array item. An explicit encoding.<name>.contentType naming one JSON media type is honoured by both targets (#4602, #4611). A member without a type ({}), each item of an array whose items have none, and other properties that the schema allows without a type travel as application/json parts too, a string included; the server keeps such a part that is not JSON as it arrives, text for a field and bytes for a file (#4728). The server parses a JSON part with the member's model field, so the field's constraints and discriminator apply; a model that populates by name also takes a part or field named like the Python field (max_age beside maxAge); typed other properties are checked by their type also when --reuse-model makes the form's model inherit an equal one; a form body whose schema is one schema or null is read and written as the form of that schema, and a multipart body that is a union of several schemas stops generation on both targets (needs an object schema to be sent as parts) (#4727). A client multipart body left without parts is sent as its closing boundary with a multipart/form-data Content-Type, which a server reads as an empty form (#4727).
  • Form encodings follow the OpenAPI version: an encoding's style, explode and allowReserved apply to URL-encoded bodies, and to multipart/form-data only in OpenAPI 3.1 and 3.2, whose parts carry the style's text without percent-encoding (the client refuses a delimited value that holds its delimiter); OpenAPI 3.0 ignores them for multipart, so the member is written and read as its contentType says. The server now reads styled members (form, deepObject, spaceDelimited, pipeDelimited), a URL-encoded member's contentType, and multipart members whose encoding names one UTF-8 or US-ASCII text media type or any media type for files, as the client writes them; a form whose exploded objects that allow other properties would take the same names stops generation on both targets, as such query parameters do (#4733), and so does such an exploded object next to other properties the form keeps, whether the schema declares them (additionalProperties true or a schema) or the model configuration keeps them (--extra-fields allow) (#4737).
  • Binary strings: a format: binary string is raw bytes that only a whole body (application/octet-stream, image/png, text/csv) or a multipart file part can carry; a text/* body whose model type is one binary string travels as raw bytes, also when the schema reaches it through $ref or a single allOf / anyOf / oneOf branch, beside null, a length limit or other binary strings (#4669), and the client method takes it as a binary body (bytes, a file object or a path). A binary string that would be sent as text (inside a JSON or URL-encoded body or response, a text/* body that is an object or array, a multipart part that is not a file, an item of a streamed response, a parameter or a header) stops generation on both targets with an error that names the operation and the schema location. Declare such a value format: byte for base64 text, optionally with --type-mappings string+byte=binary to hold the decoded bytes (#4658). The model type decides, so allOf: [{type: string}, {format: binary}] is a binary body too; bytes the models constrain (maxLength: 16 as conbytes(max_length=16)) are validated by the model: the server answers 422 to a request body and does not send a response body the model refuses, and the client raises DecodeError (unencodable for a bytes request body, invalid_value for a response) while files, paths and iterables stream unchecked. An enum or const of binary strings is text in the models and travels as text, and a binary body whose model types it as bytes only in part (type: [string, integer], bytes | int) stops generation (#4729)
  • Both targets stop on what no HTTP peer can carry (#4730): a header parameter, response header or part header whose name is not an RFC 9110 token (X Sp, X-Näme); a content key that is no media type (multipart/form data) or whose text is not ASCII header text (text/plain; label="café"); a URL-encoded body with patternProperties or that is not an object (the server reads such a body only with --server-body-mode request); a --server-router-names group key that matches no group (it was ignored) and a --client-resource-names tag that is the first tag of no operation. The server routes literal path text by its decoded value (/files/a%20b registers /files/a b, which the client's request /files/a%20b matches); literal %2F, %7B or %7D, and two operations of one method whose paths decode alike, stop generation. Client resources take their place among the derived names from their first operation, as server groups do.

... (truncated)

Changelog

Sourced from datamodel-code-generator's changelog.

0.84.0 - 2026-10-15

Highlights

Experimental: FastAPI server and Python client generation

Besides the models, datamodel-code-generator can now generate a FastAPI server package and a typed HTTPX2 client from one OpenAPI document. Both are new in 0.84.0 and experimental: options, templates and the generated packages may change in later releases (they are listed in the experimental registry with since_version 0.84.0). The generated code uses your generated models as its runtime contract: they validate requests and responses, and the generated server reads its packaged copy of the OpenAPI document only to serve it.

Get started:

# FastAPI server package in app/server/ (mkdir app && touch app/__init__.py first)
datamodel-codegen \
  --input openapi.yaml \
  --input-file-type openapi \
  --openapi-scopes schemas api \
  --output-model-type pydantic_v2.BaseModel \
  --preset standard-py312-20260909 \
  --output app/models.py \
  --generate-server fastapi \
  --server-output app/server \
  --server-package app.server \
  --server-model-package app.models
HTTPX2 client package in app/client/
datamodel-codegen 
--input openapi.yaml 
--input-file-type openapi 
--openapi-scopes schemas api 
--output-model-type pydantic_v2.BaseModel 
--preset standard-py312-20260909 
--output app/models.py 
--generate-client httpx2 
--client-output app/client 
--client-package app.client 
--client-model-package app.models

  • --generate-server / --generate-client require --server-output / --client-output, --server-package / --client-package (the import path of the package) and --server-model-package / --client-model-package (the import path of the models). --output names the model file (models.py above), not a package. The other --server-* / --client-* options are in the CLI reference.
  • A client needs a base URL: an operation without servers in the document needs --client-default-base-url, otherwise generation stops with an error
  • --generate-server and --generate-client require an explicit --input-file-type openapi: an input type left to detection, auto, or any other type stops with Error: --generate-server requires --input-file-type openapi, not auto and exit code 2 before the input is read (#4639)
  • Every server and client setting is a CLI option, a [tool.datamodel-codegen] key, and a generate() option; both targets reuse the model output options (formatters, file header, line length, and so on) (#4401, #4406, #4430)
  • --check, --diff-against, --watch and --output-format json work as for models, and so do batch jobs (#4438, #4442, #4443, #4517)
  • Target files are written like model files: edited files are overwritten, nothing is ever deleted, and --check lists leftover files as EXTRA (#4167, #4456, #4461). A generation that leaves .py files it no longer generates in the package, such as the router module of a removed tag, names them in one LeftoverFilesWarning (#4626). The required runtime dependencies are printed as a uv add ... command instead of being written to a requirements file (#4166); datamodel-code-generator does not edit pyproject.toml. --output-format json reports the package and the same dependencies as target.package and target.dependencies (#4680). The line asks for pydantic>=2.14.0, as does the client README (#4601, #4651). An explicit --target-pydantic-version older than that minimum (2, 2.11 or 2.12) is refused with Error: and exit code 2 for a server, and for a client whose models use pydantic; leave it unset or use 2.14 (#4627). A warning is shown when an existing package directory shadows a generated module, for server and client packages and also for plain model output (#4470).
  • Python API: pass generate_server="fastapi" or generate_client="httpx2" (plus server_* / client_* options) to generate(); with output=None it returns GeneratedModules with every model and package file (#4507)
  • Errors and warnings from the targets are regular dcg errors and Python warnings (#4421, #4434, #4516)
  • Groups of untagged operations: operations without a tag form the group default on both targets: routers/default.py, DefaultService, create_app(default=...) and the --server-router-names key default on the server, client.default on the client. A tag that itself derives default is numbered apart in declaration order (default, default_1) the same way on both (#4608).
  • Form bodies follow one rule on both targets: a multipart member, declared, inherited through allOf, or typed by additionalProperties, whose type has no single scalar kind (an object, a mapping, an array of objects, a mixed enum, or a union such as Filter | string or string | string[]) travels as application/json parts, one per item only for an array, and the server validates it with the member's model type. A member with a scalar kind travels as text, one value per array item. An explicit encoding.<name>.contentType naming one JSON media type is honoured by both targets (#4602, #4611). A member without a type ({}), each item of an array whose items have none, and other properties that the schema allows without a type travel as application/json parts too, a string included; the server keeps such a part that is not JSON as it arrives, text for a field and bytes for a file (#4728). The server parses a JSON part with the member's model field, so the field's constraints and discriminator apply; a model that populates by name also takes a part or field named like the Python field (max_age beside maxAge); typed other properties are checked by their type also when --reuse-model makes the form's model inherit an equal one; a form body whose schema is one schema or null is read and written as the form of that schema, and a multipart body that is a union of several schemas stops generation on both targets (needs an object schema to be sent as parts) (#4727). A client multipart body left without parts is sent as its closing boundary with a multipart/form-data Content-Type, which a server reads as an empty form (#4727).
  • Form encodings follow the OpenAPI version: an encoding's style, explode and allowReserved apply to URL-encoded bodies, and to multipart/form-data only in OpenAPI 3.1 and 3.2, whose parts carry the style's text without percent-encoding (the client refuses a delimited value that holds its delimiter); OpenAPI 3.0 ignores them for multipart, so the member is written and read as its contentType says. The server now reads styled members (form, deepObject, spaceDelimited, pipeDelimited), a URL-encoded member's contentType, and multipart members whose encoding names one UTF-8 or US-ASCII text media type or any media type for files, as the client writes them; a form whose exploded objects that allow other properties would take the same names stops generation on both targets, as such query parameters do (#4733), and so does such an exploded object next to other properties the form keeps, whether the schema declares them (additionalProperties true or a schema) or the model configuration keeps them (--extra-fields allow) (#4737).
  • Binary strings: a format: binary string is raw bytes that only a whole body (application/octet-stream, image/png, text/csv) or a multipart file part can carry; a text/* body whose model type is one binary string travels as raw bytes, also when the schema reaches it through $ref or a single allOf / anyOf / oneOf branch, beside null, a length limit or other binary strings (#4669), and the client method takes it as a binary body (bytes, a file object or a path). A binary string that would be sent as text (inside a JSON or URL-encoded body or response, a text/* body that is an object or array, a multipart part that is not a file, an item of a streamed response, a parameter or a header) stops generation on both targets with an error that names the operation and the schema location. Declare such a value format: byte for base64 text, optionally with --type-mappings string+byte=binary to hold the decoded bytes (#4658). The model type decides, so allOf: [{type: string}, {format: binary}] is a binary body too; bytes the models constrain (maxLength: 16 as conbytes(max_length=16)) are validated by the model: the server answers 422 to a request body and does not send a response body the model refuses, and the client raises DecodeError (unencodable for a bytes request body, invalid_value for a response) while files, paths and iterables stream unchecked. An enum or const of binary strings is text in the models and travels as text, and a binary body whose model types it as bytes only in part (type: [string, integer], bytes | int) stops generation (#4729)

... (truncated)

Commits
  • 213ff2c Keep root model references beside allOf constraints unless root models collap...
  • 218a2d7 Keep discriminated unions with different mappings apart when reusing models (...
  • 536064f Keep models named Literal when reused variants get Literal tags (#4761)
  • 1926d06 Rename same-named fields and types only to names no field uses (#4758)
  • d14ef07 Skip the test matrix on mid-stack layers of native stacked PRs (#4699)
  • a161259 Close allOf models when a member forbids additional properties (#4739)
  • 3a01b71 Leave msgspec constraints off unions of members of one kind (#4738)
  • 3dafb2e Refuse absorbing form members when other properties are kept (#4737)
  • 4323262 Align the docs with the 0.84.0 server, client and model changes (#4736)
  • cadf727 Map discriminator tags to reused models and keep contains bounds (#4735)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [datamodel-code-generator](https://github.com/datamodel-code-generator/datamodel-code-generator) from 0.31.2 to 0.84.0.
- [Release notes](https://github.com/datamodel-code-generator/datamodel-code-generator/releases)
- [Changelog](https://github.com/datamodel-code-generator/datamodel-code-generator/blob/main/CHANGELOG.md)
- [Commits](datamodel-code-generator/datamodel-code-generator@0.31.2...0.84.0)

---
updated-dependencies:
- dependency-name: datamodel-code-generator
  dependency-version: 0.84.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update python code labels Oct 19, 2026
@dependabot @github

dependabot Bot commented on behalf of github Oct 20, 2026

Copy link
Copy Markdown
Author

Superseded by #969.

@dependabot dependabot Bot closed this Oct 20, 2026
@dependabot
dependabot Bot deleted the dependabot/pip/sdk/python/datamodel-code-generator-0.84.0 branch October 20, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants