Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/schemas/validation/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,34 @@ properties:
$ref: '#/$defs/external-docs'
xml:
$ref: '#/$defs/xml'
if:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could this be simplified to avoid the nested if? The outer if looks redundant, so a single if/then/else should be enough here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, because the inner 'else' must also apply to the outer 'if'.

type: object
required:
- xml
then:
if:
anyOf:
- required:
- $ref
- required:
- $dynamicRef
- required:
- type
properties:
type:
const: array
then:
properties:
xml:
properties:
nodeType:
default: none
else:
properties:
xml:
properties:
nodeType:
default: element

$defs:
discriminator:
Expand Down
9 changes: 9 additions & 0 deletions tests/schema/pass/media-type-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ paths:
type: object
xml:
nodeType: none
forCoverage:
type: object
$ref: '#/components/schemas/Address'
xml: {}
forCoverage2:
type: object
$dynamicRef: '#/components/schemas/Address'
xml: {}
forCoverage3: true
application/x-www-form-urlencoded:
schema:
type: object
Expand Down