feat(oas31/style): array items label to schema name (#10794) - #10795
adrianodpdiaz wants to merge 9 commits into
Conversation
…label-to-schema-name
|
@adrianodpdiaz apparently, it is not that simple, see here #9540 |
Thanks for this link, it is more interesting than I thought! I see the concern about OAS 3.1 refs not having the same identity semantics as OAS 3.0 Reference Objects. For this PR, I was looking at a narrower UI case: array That said, after reading the discussion, I agree this should probably only happen when the referencing Schema Object has a single Right now Swagger UI only gets I think the safer path is to get that resolver metadata first, then update this PR to render the array item model name only for the clear single |
|
XzS9 Xa ZzZzz
…On Mon, 27 Apr, 2026, 9:08 pm Adriano Diaz, ***@***.***> wrote:
*adrianodpdiaz* left a comment (swagger-api/swagger-ui#10795)
<#10795 (comment)>
@adrianodpdiaz <https://github.com/adrianodpdiaz> apparently, it is not
that simple, see here #9540
<#9540>
Thanks for this link, it is more interesting than I thought!
I see the concern about OAS 3.1 refs not having the same identity
semantics as OAS 3.0 Reference Objects.
For this PR, I’m not trying to restore the old reference identity model
globally. The goal is narrower: when rendering an array items schema, use
the referenced component name as a display hint instead of the generic
Items label.
So if items resolves from #/components/schemas/User, the collapsed row
says User, while any local OAS 3.1 keywords still render inside the
schema as they do today. In that sense the label is not claiming “this
schema is exactly the User component”; it is just making the *array item
type* visible to the reader.
I’m not trying to bring back the old reference identity behaviour
everywhere, just make array item labels less generic when there is a clear
referenced component.
For broader decisions about identity semantics I opened the feature
request in the swagger-client so it can be decided in the UI in what cases
would be interesting to render or not: swagger-api/swagger-client#4201
<swagger-api/swagger-client#4201> - for this
feature, imo it is strict enough to only decrease the generic level of
rendering for the user.
—
Reply to this email directly, view it on GitHub
<#10795 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AJXZUN43TXEKK2CVIANZRKD4X55F5AVCNFSM6AAAAACXKZP4ZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DGMRYGMZDIOBSGU>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
|
DD zlxS sde ZZ s DD xs6,
On Tue, 28 Apr, 2026, 11:48 am Devdutt Sharma, ***@***.***>
wrote:
… XzS9 Xa ZzZzz
On Mon, 27 Apr, 2026, 9:08 pm Adriano Diaz, ***@***.***>
wrote:
> *adrianodpdiaz* left a comment (swagger-api/swagger-ui#10795)
> <#10795 (comment)>
>
> @adrianodpdiaz <https://github.com/adrianodpdiaz> apparently, it is not
> that simple, see here #9540
> <#9540>
>
> Thanks for this link, it is more interesting than I thought!
>
> I see the concern about OAS 3.1 refs not having the same identity
> semantics as OAS 3.0 Reference Objects.
>
> For this PR, I’m not trying to restore the old reference identity model
> globally. The goal is narrower: when rendering an array items schema,
> use the referenced component name as a display hint instead of the generic
> Items label.
>
> So if items resolves from #/components/schemas/User, the collapsed row
> says User, while any local OAS 3.1 keywords still render inside the
> schema as they do today. In that sense the label is not claiming “this
> schema is exactly the User component”; it is just making the *array item
> type* visible to the reader.
>
> I’m not trying to bring back the old reference identity behaviour
> everywhere, just make array item labels less generic when there is a clear
> referenced component.
>
> For broader decisions about identity semantics I opened the feature
> request in the swagger-client so it can be decided in the UI in what cases
> would be interesting to render or not: swagger-api/swagger-client#4201
> <swagger-api/swagger-client#4201> - for this
> feature, imo it is strict enough to only decrease the generic level of
> rendering for the user.
>
> —
> Reply to this email directly, view it on GitHub
> <#10795 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AJXZUN43TXEKK2CVIANZRKD4X55F5AVCNFSM6AAAAACXKZP4ZSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DGMRYGMZDIOBSGU>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
|
Description
In the OAS 3.1 model viewer, when a schema has an array property whose
itemspoints to a$ref, the label for the items entry was hardcoded toItemsregardless of the referenced schema name. This change makes it display the actual referenced schema name (e.g.User) instead, bringing it in line with the OAS 3.0 UI.Motivation and Context
#10794
How Has This Been Tested?
makeGetTitlecovering all relevant cases (test/unit/core/plugins/oas31/json-schema-2020-12-extensions/fn.js)test/e2e-cypress/e2e/features/oas31-array-items-label.cy.js)npm run dev) with an OAS 3.1 spec containing array properties with$refitems — the label now shows the schema name instead ofItemsitemsschemas still showItemsas fallbackScreenshots:
BEFORE:

AFTER:

Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests