-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Description
In packages/apidom-ns-openapi-3-2/src/refractor/plugins/replace-empty-element.ts, the ComponentsMediaTypesElement NCE (Non-Concrete Element) — new in OAS 3.2 — is correctly imported and referenced in the ComponentsElement section (line 345). However, unlike other NCE elements, there is no corresponding [ComponentsMediaTypesElement.primaryClass] entry in the dynamic key-based NCE schema section.
Expected Behavior
A [ComponentsMediaTypesElement.primaryClass] entry should exist in the NCE section (alongside [ComponentsPathItemsElement.primaryClass], [WebhooksElement.primaryClass], etc.) to handle empty-node replacement for this element type.
Actual Behavior
ComponentsMediaTypesElement only appears at:
- Line 78: import
- Line 345: used inside
ComponentsElementblock
There is no [ComponentsMediaTypesElement.primaryClass] entry in the NCE section (around line 505+).
Reference
Raised in PR #5110, comment: #5110 (comment)
Suggested Fix
Add the following entry to the NCE section of the schema (after [ComponentsPathItemsElement.primaryClass]):
[ComponentsMediaTypesElement.primaryClass]: {
'[key: *]': function key(...args: any[]) {
return new MediaTypeElement(...args);
},
},(The element type mapped by [key: *] should be verified against the OAS 3.2 spec for the components/mediaTypes field.)