Skip to content

fix(schema-model): preserve descriptions on referenced properties and arrays [TDX-5454] - #997

Open
arashsheyda wants to merge 1 commit into
mainfrom
TDX-5454-add-missing-property-descriptions
Open

arashsheyda wants to merge 1 commit into
mainfrom
TDX-5454-add-missing-property-descriptions

Conversation

@arashsheyda

@arashsheyda arashsheyda commented Sep 10, 2026

Copy link
Copy Markdown
Member

Summary

ticket: https://konghq.atlassian.net/browse/TDX-5454

In the spec display when we have a property that is a user defined class or an array of classes, the definition in the main class is not displayed. In the example attached, I want to add more detail to the collection of stops but I can only update the single stop description.

Screenshot 2026-09-10 at 1 28 26 PM

@arashsheyda arashsheyda self-assigned this Sep 10, 2026
@arashsheyda
arashsheyda requested a review from a team as a code owner September 10, 2026 16:43
@kongponents-bot

Copy link
Copy Markdown
Collaborator

Install the preview package from this PR

@kong/spec-renderer@pr-997

@kongponents-bot

Copy link
Copy Markdown
Collaborator

🔴 PR audit failed. 🔴

🔥 PNPM Audit issues detected.

┌─────────────────────┬────────────────────────────────────────────────────────┐
│ high                │ js-yaml: maxTotalMergeKeys does not limit CPU use for  │
│                     │ empty merge sources                                    │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Package             │ js-yaml                                                │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Vulnerable versions │ >=4.0.0 <4.3.2                                         │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Patched versions    │ >=4.3.2                                                │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ Paths               │ .>@asyncapi/avro-schema-parser>@asyncapi/parser>js-    │
│                     │ yaml                                                   │
│                     │                                                        │
│                     │ .>@asyncapi/openapi-schema-parser>@asyncapi/parser>js- │
│                     │ yaml                                                   │
│                     │                                                        │
│                     │ .>@asyncapi/parser>js-yaml                             │
├─────────────────────┼────────────────────────────────────────────────────────┤
│ More info           │ https://github.com/advisories/GHSA-2883-xcg3-v3hh      │
└─────────────────────┴────────────────────────────────────────────────────────┘
1 vulnerabilities found
Severity: 1 high

PR with those issues cannot be merged.

How to resolve:

  • Check open renovate PRs for updates to the dependencies mentioned in the audit report
  • try to update dependencies listed in the audit report to the latest versions
  • use pnpm audit --fix to automatically fix issues

@vaibhavrajsingh2001 vaibhavrajsingh2001 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a better approach for handling descriptions being defined for array type schemas.
This PR adds a preference for picking up the schema's own description over the array item's description, but this means the array item's description isn't visible anywhere anymore.

Image

Comment thread src/utils/schema-model.ts
...resolveAllOf(candidate.items),
...(Object.hasOwn(candidate, 'description') ? { description: candidate.description } : {}),
type: candidate.type,
itemType: candidate.items.type,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like we have multiple cases of fields being defined at the top level for array schemas, instead of being defined inside items.
So we should probably build a list of keys that need to be picked up from candidate itself instead of candidate.items

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.

3 participants