Describe the bug.
The diff command doesn't work when there is a circular reference in the structure
Expected behavior
No error exit code + skip circular properties if can not be handled by diff
Screenshots
not needed
How to Reproduce
Create a valid openapi 3.1.0 file with a circular reference:
asyncapi: 3.1.0
info:
title: Testing
version: 1.0.0
channels:
my_entity_created:
messages:
entity-created:
payload:
$ref: '#/components/schemas/entity-created'
operations:
my_entity_created:
action: send
channel:
$ref: '#/channels/my_entity_created'
components:
schemas:
filters:
type: array
items:
anyOf:
- $ref: '#/components/schemas/filters'
- type: string
entity-created:
type: object
properties:
filters:
type: array
items:
$ref: '#/components/schemas/filters'
Ensure it's valid:
$ docker run -it --rm -v "$(pwd):/asyncapi" "asyncapi/cli:6.0.0" validate /asyncapi/file.yaml
# ...
File /asyncapi/file.yaml is valid! File /asyncapi/file.yaml and referenced documents don't have governance issues.
Skipping submitting anonymous metrics due to the following error: TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'items' -> object with constructor 'Object'
| property 'anyOf' -> object with constructor 'Array'
--- index 0 closes the circle
$ echo $?
0
Run diff:
$ docker run -it --rm -v "$(pwd):/asyncapi" "asyncapi/cli:6.0.0" diff --log-diagnostics /asyncapi/file.yaml /asyncapi/file.yaml
Diagnostics for /asyncapi/file.yaml:
File /asyncapi/file.yaml is valid! File /asyncapi/file.yaml and referenced documents don't have governance issues.
Diagnostics for /asyncapi/file.yaml:
File /asyncapi/file.yaml is valid! File /asyncapi/file.yaml and referenced documents don't have governance issues.
ValidationError:
There is a ValidationError with no message.
Removing the circular ref, it works:
$ yq -i 'del(.components.schemas.filters.items.anyOf[0])' file.yaml
$ docker run -it --rm -v "$(pwd):/asyncapi" "asyncapi/cli:6.0.0" diff /asyncapi/file.yaml /asyncapi/file.yaml
changes: []
🖥️ Device Information [optional]
No response
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
None
Describe the bug.
The diff command doesn't work when there is a circular reference in the structure
Expected behavior
No error exit code + skip circular properties if can not be handled by diff
Screenshots
not needed
How to Reproduce
Create a valid openapi 3.1.0 file with a circular reference:
Ensure it's valid:
Run diff:
There is a
ValidationErrorwith no message.Removing the circular ref, it works:
🖥️ Device Information [optional]
No response
👀 Have you checked for similar open issues?
🏢 Have you read the Contributing Guidelines?
Are you willing to work on this issue ?
None