feat(oas31/style): array items label to schema name (#10794)#10795
feat(oas31/style): array items label to schema name (#10794)#10795adrianodpdiaz wants to merge 8 commits intoswagger-api:masterfrom
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 |
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