Azure / Azure/azure-functions-openapi-extension

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

Open
#689 1 comment 0 reactions 0 assignees View on GitHub
feature: api-description Needs: Triage (Functions) potential-bug
Dominant language
C#
Stars
388
Forks
202
PR merge metrics
No merged PRs in 30d

Description

### 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.