| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Adds a [tool.uv.sources] override resolving openapi-python-client from alexander-wenzel-dev/openapi-python-client at branch pin/mealie-mcp-combined. The branch carries two unmerged generator fixes (upstream PRs openapi-generators/openapi-python-client#1448 and openapi-generators/openapi-python-client#1449) that unblock the Recipe-Input / Recipe-Output models and the PUT/PATCH recipe endpoints in the generated client. This commit only changes resolution; the generated client tree is untouched and gets regenerated in a separate PR. Removal plan is inline in pyproject.toml.
Tools like FastAPI emit duplicate `title` values for input and output variants of the same model (for example `Thing-Input` and `Thing-Output` both carrying `title: Thing`). The class name is derived from the title, so the second variant collided with the first and was rejected with `Attempted to generate duplicate models`. The generator emitted a warning and silently dropped the schema along with every endpoint that referenced it. When the title-derived class name is already taken, the second variant now falls back to a class name derived from its schema key (`Thing-Output` becomes `ThingOutput`) provided that key is unique. The original schema's name is preserved, and both variants and their endpoints generate. A functional test in `end_to_end_tests/functional_tests` covers the inline spec, and a unit test in `tests/test_parser/test_properties/test_model_property.py` exercises the new branch in `ModelProperty.build`.
|
Rebased onto main at v0.29.1. The fix and its tests carry over unchanged. One adaptation was needed. Main narrowed the ruff exclude to the golden records and the snapshots, so the new functional test has to satisfy ruff format now. The only change is the indentation of the inline spec passed to with_generated_client_fixture. On Python 3.14 with the locked ruff, ruff format --check, ruff check, mypy and the full test suite pass, and coverage stays at 100%. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
fix: fall back to schema key when two schemas share a title
Summary
When two component schemas declare the same title, the second one was
silently dropped along with every endpoint that referenced it. This PR
makes the second variant fall back to a class name derived from its
schema key so both schemas survive.
Problem
Tools like FastAPI emit duplicate title values for input and output
variants of the same model (for example Thing-Input and Thing-Output
both carrying title: Thing). The class name is derived from the title,
so the second variant collides with the first and is rejected with
Attempted to generate duplicate models. The generator emits a warning
but exits 0, so the schema and every endpoint that referenced it are
silently dropped from the generated client.
Minimal reproduction
Before this PR: Thing-Output and any endpoint that references it are
absent from the generated client, and the only signal is a warning on
stderr.
Fix
In ModelProperty.build, when the title-derived class name is already
taken, fall back to a class name derived from the schema key
(Thing-Output becomes ThingOutput) provided that key is unique.
The original schema's name is preserved, and both variants and their
endpoints generate.
The fallback is guarded by data.title and name so it only triggers
in the duplicate-title case. If the fallback name also collides, the
existing Attempted to generate duplicate models error path still
fires unchanged.
Tests
end_to_end_tests/functional_tests/generated_code_execution/test_title_collisions.py
— uses the inline spec above and asserts both Thing and
ThingOutput exist and round-trip correctly.
tests/test_parser/test_properties/test_model_property.py
(TestBuild::test_model_name_conflict_fallback) exercises the new
branch in ModelProperty.build directly.
Local verification
All green on Python 3.14. 100% coverage on the changed file
(model_property.py). Golden-record snapshot tests pass without
regeneration — no generated output changes for any existing spec in
the upstream baseline.
Risk
name; the second falls back to the schema-key-derived name. For the
motivating Thing-Input / Thing-Output case this is the desired
result. A schema author who expected the second variant to claim
the title would see different output, but that case previously
errored out, so this is a strict improvement over the prior failure
mode.
ModelProperty.build; nothing else in the parser or templates is
touched.
Related
Companion PR: #1449 — a second independent fix for
freeform-object defaults, surfaced from the same downstream spec.
The two PRs share no code paths and can land in either order.