Skip to content

Comments

fix(JsonSchema): avoid schema name collision when an operation name is already used by another class#7778

Merged
soyuka merged 1 commit intoapi-platform:4.2from
wuchen90:fix-definition-name-factory
Feb 20, 2026
Merged

fix(JsonSchema): avoid schema name collision when an operation name is already used by another class#7778
soyuka merged 1 commit intoapi-platform:4.2from
wuchen90:fix-definition-name-factory

Conversation

@wuchen90
Copy link
Contributor

Q A
Branch? 4.2
License MIT

When two API resources have the same class short name but are in different namespace, the schema section of OpenApi specs will only keep the first one.

Given

NamespaceA\MyResource:
  - propertyA: string

NamespaceB\MyResource:
  - propertyB: string

The current buggy behavior will produce a openapi.json like this with only one schema =>

{
  "components": {
    "schemas": {
      "MyResource": {
        "type": "object",
        "properties": {
          "propertyA": {
            "type": "string"
          }
        }
      }
    }
  }
}

So this leads to operations that use NamespaceB\MyResource will references to NamespaceA\MyResource schema.

@soyuka soyuka force-pushed the fix-definition-name-factory branch from b44db75 to 6bb31ab Compare February 20, 2026 20:32
@soyuka soyuka merged commit 17b6ff2 into api-platform:4.2 Feb 20, 2026
128 checks passed
soyuka pushed a commit that referenced this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants