dependabot[bot] opened a new pull request, #19090: URL: https://github.com/apache/iceberg/pull/19090
Bumps [datamodel-code-generator](https://github.com/datamodel-code-generator/datamodel-code-generator) from 0.91.0 to 0.96.0. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/datamodel-code-generator/datamodel-code-generator/releases">datamodel-code-generator's releases</a>.</em></p> <blockquote> <h2>0.96.0</h2> <h2>Breaking Changes</h2> <h3>Code Generation Changes</h3> <ul> <li>Generated client methods return raw bodies for itemSchema stream responses - For an OpenAPI 3.2 response media of <code>text/event-stream</code> or a JSON Lines or NDJSON type (<code>application/jsonl</code>, <code>application/jsonlines</code>, <code>application/ndjson</code>, <code>application/x-jsonl</code>, <code>application/x-jsonlines</code>, <code>application/x-ndjson</code>) whose schema is only an <code>itemSchema</code>, the generated client no longer binds the model of the item schema's array projection to the operation's response. The operation method, its <code>with_response</code> view and its result type alias now read the whole body raw: <code>str</code> for an event stream (a text branch) and <code>bytes</code> for JSON Lines or NDJSON (a binary branch). For example, <code>WatchEventsResponse</code> becomes <code>str</code>, and a JSON plus JSON Lines response becomes <code>models.ExcerptGetResponse | bytes</code>. Code that relied on the old result type must p arse the raw body or use the new stream helper that regenerated clients now get at <code>client.protocols.<resource>.<method></code>, which yields typed items (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6767">#6767</a>)</li> <li>Generated client stream helpers now type items as the model the <code>itemSchema</code> references - In generated Python clients, SSE, JSON Lines and NDJSON stream helpers whose <code>itemSchema</code> is a bare <code>$ref</code> now use the referenced model, for example <code>EventStream[models.LogEntry]</code>, <code>AsyncEventStream[models.Event]</code> and <code>EventPlan[models.LogEntry]</code>. Before, they used the duplicate <code>ItemSchema</code> or <code>ItemSchemaModel</code> model generated at the item schema location. The codecs in <code>_generated/model_bindings.py</code> change to match. With Pydantic v2 output, decoded stream items are now instances of the referenced model, for example <code>models.LogEntry</code> instead of <code>models.ItemSchemaModel</code>, and validation error messages name that model. With dataclasses output, only the type annotations change. Code that annotates, <code>isinstance</code>-checks or pattern-matches stream items against <code >models.ItemSchema</code> or <code>models.ItemSchemaModel</code> has to switch >to the referenced model (<a >href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6771">#6771</a>)</li> <li>Const, enum and allOf branches no longer take object keywords under <code>--read-object-keywords-by-type</code> - With <code>--read-object-keywords-by-type</code>, which the standard and practical 20261112 presets also turn on, the check for an <code>anyOf</code> or <code>oneOf</code> branch that admits no object now looks at more than a declared <code>type</code> or a <code>$ref</code> to such a schema. It also counts <code>const</code>, <code>enum</code>, nested <code>allOf</code>, <code>anyOf</code> and <code>oneOf</code> parts, false schemas, and the full schema a <code>$ref</code> names together with the keywords beside it. Branches found this way are now read without the sibling <code>properties</code>, <code>patternProperties</code>, <code>additionalProperties</code>, <code>propertyNames</code>, <code>unevaluatedProperties</code>, <code>required</code>, <code>minProperties</code> and <code>maxProperties</code>. For example, an <code>anyOf</code> of a <code>const</code> branch, an <code>enum</code> branch and an object branch next to <code>properties</code> and <code>required</code> used to generate a single model field <code>Owner | None</code> and now generates a union like <code>Literal['none'] | Owner | Owner1 | None</code>. That adds new enum classes and can shift model names: the former <code>Owner</code> model becomes <code>Owner1</code>. Under <code>--generate-schema-validators</code> these sites also become unions instead of one validated object model. Output without the option is unchanged (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6777">#6777</a>)</li> <li>Regex patterns containing quotes are written differently in Pydantic v2 output - With <code>pydantic_v2.BaseModel</code> and <code>pydantic_v2.dataclass</code> output, a <code>pattern</code> containing a single quote used to be written as a single-quoted raw literal with the quote escaped by a backslash, for example <code>constr(pattern=r'^it\'s$')</code>. Because raw literals keep backslashes, the runtime pattern string had an extra backslash before the quote. The generator now picks a quote character the pattern does not use, so this becomes <code>constr(pattern=r"^it's$")</code>. A pattern containing both quote characters is now written as a plain (non-raw) literal, for example <code>'^a-z\'"+$'</code> instead of <code>r'^a-z\'"+$'</code>, and backslashes in such patterns are doubled. A pattern that already holds a backslash before a quote changes only in source text: <code>"^don\\'t$"</code> becomes <code>r"^don\'t$"</code>. This aff ects string field patterns, <code>propertyNames</code> key patterns, and <code>StringConstraints</code> written under <code>--field-constraints</code> or <code>--use-annotated</code>. Python's <code>re</code> matches the same values, so validation does not change. However, the pattern stored in <code>constr</code> or <code>StringConstraints</code>, and the pattern that <code>model_json_schema()</code> publishes (for example in FastAPI OpenAPI docs), no longer has the extra backslash. The generated source text for these fields also changes, so snapshot tests or committed generated code will show differences after regenerating (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6790">#6790</a>)</li> </ul> <h3>Error Handling Changes</h3> <ul> <li>Helper names that collide with derived item stream helpers are now refused - When an OpenAPI 3.2 document has responses that stream an <code>itemSchema</code>, generation now derives a stream helper named <code><resource>.<method></code> for each such operation. A helper in the protocols helper file whose name contains a derived name, or is contained in one (for example a declared helper named <code>default</code> beside the derived <code>default.watch_events</code>), now fails generation with an <code>E_NAME_COLLISION</code> config diagnostic reported under the client protocols option. The same helper file used to generate. To fix it, rename the declared helper (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6767">#6767</a>)</li> <li>Deprecation and migration notices now name the code that called datamodel-code-generator instead of a module inside the package - Notices emitted through the central deprecation registry used to be attributed to a frame inside <code>datamodel_code_generator</code>, picked by a fixed <code>stacklevel</code> at each call site. They are now attributed to the outermost frame outside the package. In the Python API that is the user module that called <code>generate()</code> or another API. In the CLI it is the console script, or the <code>runpy</code> frame for <code>python -m</code>. This covers the optional-dependency notices (Genson, Jinja2, Black/isort, Pydantic runtime minimum), the default formatters notice, the deprecated <code>--validation</code>, <code>--parent-scoped-naming</code> and <code>--allow-extra-fields</code> notices, the remote <code>$ref</code> default notice, the OpenAPI <code>nullable</code> and JSON Schema array <code>items</code> notices, <code>PythonVersion .has_type_alias</code> and the other registry notices. As a result, each notice reports a different filename, line number and module. Filters that matched these notices by <code>module="datamodel_code_generator"</code> no longer suppress them, whether set in <code>warnings.filterwarnings</code>, <code>-W</code>, <code>PYTHONWARNINGS</code> or pytest <code>filterwarnings</code>. To silence them, filter by category and message, or target the calling module, for example <code>warnings.filterwarnings("ignore", category=FutureWarning, module="mypackage.models")</code>. Python's default filters show <code>DeprecationWarning</code> only when it is attributed to <code>__main__</code>. A script that calls the API directly may therefore now show registry notices of category <code>DeprecationWarning</code> that were hidden before (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6793">#6793</a>)</li> </ul> <!-- raw HTML omitted --> <h2>What's Changed</h2> <ul> <li>List client and server generation in What it does by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6766">datamodel-code-generator/datamodel-code-generator#6766</a></li> <li>Stream OpenAPI 3.2 itemSchema responses in the generated client by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6767">datamodel-code-generator/datamodel-code-generator#6767</a></li> <li>Bind the model a $ref names, not a root model another use made there by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6771">datamodel-code-generator/datamodel-code-generator#6771</a></li> <li>Skip the Genson notice when an installed package declares the extra by <a href="https://github.com/shcheklein"><code>@shcheklein</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6785">datamodel-code-generator/datamodel-code-generator#6785</a></li> <li>Stop fact walks at mapped refs in one ref-follow step by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6775">datamodel-code-generator/datamodel-code-generator#6775</a></li> <li>Decide a branch's object exclusion by one predicate by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6776">datamodel-code-generator/datamodel-code-generator#6776</a></li> <li>Read const, enum and allOf branches for object keywords by type by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6777">datamodel-code-generator/datamodel-code-generator#6777</a></li> <li>Merge every class that inherits an enum into the enum by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6781">datamodel-code-generator/datamodel-code-generator#6781</a></li> <li>Keep a regex holding a quote unchanged in the pattern literal by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6790">datamodel-code-generator/datamodel-code-generator#6790</a></li> <li>Type users of unmodelled mapped and x-python-import refs by import by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6791">datamodel-code-generator/datamodel-code-generator#6791</a></li> <li>Give GraphQL models a __typename property graphql-core can read by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6792">datamodel-code-generator/datamodel-code-generator#6792</a></li> <li>Point dependency notices at the code that called the library by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6793">datamodel-code-generator/datamodel-code-generator#6793</a></li> <li>Import a mapped class only in the modules that use it by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6796">datamodel-code-generator/datamodel-code-generator#6796</a></li> <li>Accept stacklevel in warn_deprecated again by <a href="https://github.com/koxudaxi"><code>@koxudaxi</code></a> in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6802">datamodel-code-generator/datamodel-code-generator#6802</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/shcheklein"><code>@shcheklein</code></a> made their first contribution in <a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/pull/6785">datamodel-code-generator/datamodel-code-generator#6785</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/datamodel-code-generator/datamodel-code-generator/compare/0.95.0...0.96.0">https://github.com/datamodel-code-generator/datamodel-code-generator/compare/0.95.0...0.96.0</a></p> <h2>0.95.0</h2> <h2>Breaking Changes</h2> <h3>Code Generation Changes</h3> <ul> <li>Required nullable parameters in generated FastAPI servers are now typed without None - A required query, path, header or cookie parameter can have a nullable schema, such as OpenAPI 3.0 <code>nullable: true</code> or 3.1 <code>type: [string, "null"]</code>, and not be described by <code>content</code>. For such a parameter, the generated router endpoint now writes the plain type, for example <code>Annotated[str, Query(alias='q')]</code> instead of <code>Annotated[str | None, Query(alias='q')]</code>. The generated service Protocol method now takes it as <code>q: str</code> instead of <code>q: str | None</code>. This also covers a nullable type that the target reads through a root model or alias. Optional parameters and parameters with a <code>content</code> media type keep <code>| None</code>. Implementations that still declare <code>X | None</code> keep type-checking, because such a parameter can never receive None. After regenerating, though, code that calls servic e methods with None for these parameters, or that relies on the old signatures, gets type errors. FastAPI's own OpenAPI document, served with <code>source_openapi=False</code>, also no longer marks these parameters nullable. (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6737">#6737</a>)</li> <li>Schema validators no longer read references mapped by <code>--external-ref-mapping</code> - With <code>--generate-schema-validators</code>, a <code>$ref</code> that <code>--external-ref-mapping</code> maps to an imported class is no longer loaded when runtime validation rules are collected. Before, if the mapped document could be read, its rules went into the generated validators. These were <code>minProperties</code>/<code>maxProperties</code> and scoped object rules such as <code>patternProperties</code> reached through <code>allOf</code>/<code>anyOf</code>/<code>oneOf</code> items, and the <code>uniqueItems</code> rules of union branches. Now the mapped reference adds no rules, and it is treated as possibly accepting both object and array data. Generated models can therefore lose validation checks they had before, for example the <code>uniqueItems</code> check on an array branch next to a mapped object branch, and accept data they used to reject. Schemas that used to fail b ecause the mapped document was missing or refused by <code>--strict-refs</code> now generate. (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6762">#6762</a>)</li> </ul> <h3>Default Behavior Changes</h3> <ul> <li>Dynamic model generation no longer formats generated code by default - <code>generate_dynamic_models()</code> and <code>generate_dynamic_module()</code> now skip formatting when none of <code>formatters</code>, <code>custom_formatters</code> or the config's <code>preset</code> selects formatters. Before, they formatted the code with Black and isort, as <code>generate()</code> does. Black and isort are no longer imported in that case, and the "Default formatters will change to builtin" <code>FutureWarning</code> is no longer emitted. Presets that do not set formatters, such as <code>standard-py313-20260619</code>, now also give unformatted code. Formatting stripped spaces and tabs from the ends of lines in class docstrings. So with <code>use_schema_description=True</code>, a schema description whose lines end with spaces or tabs (for example a Markdown hard break) now keeps that trailing whitespace in the class <code>__doc__</code> and in the <code>description</code> that Pydantic's <code>model_json_schema()</code> reports. Set <code>formatters</code> (for example <code>formatters=[Formatter.BUILTIN]</code>) to bring back formatting and the stripped docstrings. <code>generate()</code> and the CLI are unchanged. (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6750">#6750</a>)</li> <li>New FutureWarning when custom templates are used - Generation with a custom template directory (<code>--custom-template-dir</code>, <code>custom-template-dir</code> in pyproject.toml, or <code>custom_template_dir</code> in the <code>generate()</code> config) now emits the <code>dependency.jinja2-optional</code> FutureWarning "Jinja2 will become optional. Declare the jinja2 extra for --custom-template-dir; see --help." It is shown once per CLI invocation and on each <code>generate()</code> call. Python shows FutureWarning by default, so this is new stderr output for existing users. Setups that turn warnings into errors (<code>-W error</code>, <code>PYTHONWARNINGS=error</code>, pytest <code>filterwarnings = error</code>) now fail until the warning is filtered. Jinja2 is still a required dependency; declare the new <code>jinja2</code> extra to prepare for it becoming optional. (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues /6755">#6755</a>)</li> <li>New FutureWarning when generating from raw data input - Generating from JSON, YAML, CSV or dict sample data (<code>--input-file-type json</code>, <code>yaml</code> or <code>csv</code>, or <code>generate()</code> with a dict) now emits the <code>dependency.genson-optional</code> FutureWarning "Genson will become optional. Declare the genson extra for JSON, YAML, CSV and dict input; see --help." Schema inputs such as JSON Schema and OpenAPI do not warn. Setups that turn warnings into errors now fail for these inputs until the warning is filtered. Genson is still a required dependency; declare the new <code>genson</code> extra to prepare for it becoming optional. (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6755">#6755</a>)</li> </ul> <h3>Error Handling Changes</h3> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/2c0111e2c46bda51d02f30af2f7fb81c630614b2"><code>2c0111e</code></a> Accept stacklevel in warn_deprecated again (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6802">#6802</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/e426c9595acc35469997d192555005cf899bb64a"><code>e426c95</code></a> Import a mapped class only in the modules that use it (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6796">#6796</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/60749413e83fcd503c88b92fba2b9e53500ec135"><code>6074941</code></a> Cut the release-draft behaviour diff in jq instead of with head (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6794">#6794</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/c90bf1086a084a65331a8a5bff0c41c0f8fef0f1"><code>c90bf10</code></a> Point dependency notices at the code that called the library (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6793">#6793</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/6945ef2d332975cd0c17cff778896f32c06eebee"><code>6945ef2</code></a> Give GraphQL models a __typename property graphql-core can read (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6792">#6792</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/1d8de06e9d827f0795659e06d32f925481251ae4"><code>1d8de06</code></a> Type users of unmodelled mapped and x-python-import refs by import (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6791">#6791</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/30b8128b2c8fce3a462b4ac31b946df3349f5131"><code>30b8128</code></a> Keep a regex holding a quote unchanged in the pattern literal (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6790">#6790</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/42c4d69332d0018119077e9f8058657f12e7e8c0"><code>42c4d69</code></a> Merge every class that inherits an enum into the enum (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6781">#6781</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/a9eaea2f94abdd9d860320d5843304d8e9ffffd5"><code>a9eaea2</code></a> Read const, enum and allOf branches for object keywords by type (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6777">#6777</a>)</li> <li><a href="https://github.com/datamodel-code-generator/datamodel-code-generator/commit/758cb11afe902277e9436b20d86b867b9d18cc67"><code>758cb11</code></a> Decide a branch's object exclusion by one predicate (<a href="https://redirect.github.com/datamodel-code-generator/datamodel-code-generator/issues/6776">#6776</a>)</li> <li>Additional commits viewable in <a href="https://github.com/datamodel-code-generator/datamodel-code-generator/compare/0.91.0...0.96.0">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) 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-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> 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) </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
