Skip to content

Swagger is not being generated when 2 properties are named the same in the JSON #689

@Zircon99

Description

@Zircon99

Description

Swagger is not being generated when 2 properties are named the same in the JSON

As an example:

{
"Data": {
"PaymentStatusReport": {
"GroupHeader": {
"MessageIdentification": "68aeee18-ff7b-bbbc-adc9-e6ad276f7b8e",
"CreationDateTime": "2025-03-26T14:22:56.7458341+00:00"
},
"OriginalGroupInformationAndStatus": {
"MessageIdentification": "",
"OriginalMessageNameIdentification": "",
"GroupStatus": "ABCD",
"StatusReasonInformation": null
}
}

Although MessageIdentification have different parent properties, the Swagger generation breaks because it sees them as the same thing (duplicate definition), instead of as 2 unique properties.

Steps to reproduce

Create a structure that has 2 properties named the same, but with different parents properties - in this case, "MessageIdentification":

{
"Data": {
"PaymentStatusReport": {
"GroupHeader": {
"MessageIdentification": "68aeee18-ff7b-bbbc-adc9-e6ad276f7b8e",
"CreationDateTime": "2025-03-26T14:22:56.7458341+00:00"
},
"OriginalGroupInformationAndStatus": {
"MessageIdentification": "",
"OriginalMessageNameIdentification": "",
"GroupStatus": "ABCD",
"StatusReasonInformation": null
}
}

Allow it to generate Swagger.

Result - the Swagger generation breaks, as it sees "MessageIdentification" being defined twice, instead of seeing them as two unique properties, as they have unique parent properties.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions