Skip to content

fix(InlineModelResolver): do not merge untitled inline schemas differing only by description#24192

Merged
wing328 merged 10 commits into
masterfrom
fix-24004
Jul 3, 2026
Merged

fix(InlineModelResolver): do not merge untitled inline schemas differing only by description#24192
wing328 merged 10 commits into
masterfrom
fix-24004

Conversation

@wing328

@wing328 wing328 commented Jul 3, 2026

Copy link
Copy Markdown
Member

based on #24007

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Limit structural-signature deduplication to titled schemas so anonymous inline schemas that differ only by description are no longer merged. This prevents accidental type collapsing and generates distinct models where appropriate.

  • Bug Fixes
    • Updated InlineModelResolver.matchGenerated to apply structural-signature matching only to titled schemas; untitled inline schemas now remain distinct even if structurally identical after stripping volatile fields.
    • Regenerated samples to reflect distinct models and updated API signatures:
      • Crystal: added FilterMust, FilterMustNot, PrefetchPrefetch, TrackerStatusOneOf1; updated Filter.must/must_not, Prefetch.prefetch, and TrackerStatus to use them.
      • C#: introduced TestEnumParametersEnumHeaderStringParameter; used for both enum_header_string and enum_query_string, updated converters, FakeApi parameter types, docs, and tests across GenericHost samples.
      • Python (python-httpx, python-httpx-sync, python-aiohttp, python-lazyImports, python-pydantic-v1-aiohttp): added UploadFileWithAdditionalPropertiesRequestObject; updated FakeApi.upload_file_with_additional_properties to use it, refreshed docs, and updated tests (including a unit test for the model in python-httpx-sync).

Written for commit d1d9c98. Summary will update on new commits.

Review in cubic

@wing328 wing328 marked this pull request as ready for review July 3, 2026 06:57
@wing328

wing328 commented Jul 3, 2026

Copy link
Copy Markdown
Member Author

CI failure (php-laravel) not related to this PR and will be addressed in another PR instead.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 128 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/openapi3/client/petstore/python-pydantic-v1/tests/test_rest.py">

<violation number="1" location="samples/openapi3/client/petstore/python-pydantic-v1/tests/test_rest.py:25">
P0: Line 25 creates an `UploadFileWithAdditionalPropertiesRequestObject`, but line 30 passes it as `marker` to `test_object_for_multipart_requests`, which expects `TestObjectForMultipartRequestsRequestMarker`. These are distinct classes — the test will fail at runtime with a type/validation error.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

mock_resp.headers = {}

marker = petstore_api.TestObjectForMultipartRequestsRequestMarker(
marker = petstore_api.UploadFileWithAdditionalPropertiesRequestObject(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P0: Line 25 creates an UploadFileWithAdditionalPropertiesRequestObject, but line 30 passes it as marker to test_object_for_multipart_requests, which expects TestObjectForMultipartRequestsRequestMarker. These are distinct classes — the test will fail at runtime with a type/validation error.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/python-pydantic-v1/tests/test_rest.py, line 25:

<comment>Line 25 creates an `UploadFileWithAdditionalPropertiesRequestObject`, but line 30 passes it as `marker` to `test_object_for_multipart_requests`, which expects `TestObjectForMultipartRequestsRequestMarker`. These are distinct classes — the test will fail at runtime with a type/validation error.</comment>

<file context>
@@ -22,7 +22,7 @@ def test_multipart_requests(self):
         mock_resp.headers = {}
 
-        marker = petstore_api.TestObjectForMultipartRequestsRequestMarker(
+        marker = petstore_api.UploadFileWithAdditionalPropertiesRequestObject(
             name="name",
         )
</file context>
Suggested change
marker = petstore_api.UploadFileWithAdditionalPropertiesRequestObject(
marker = petstore_api.TestObjectForMultipartRequestsRequestMarker(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Inline Schema Handling Schema contains a complex schema in items/additionalProperties/allOf/oneOf/anyOf Issue: Regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant