-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Describe the bug.
InvalidTypeError thrown during document parsing of valid OpenAPI3 schema, that use nullable: true
.
The error only occurs when there are at least two messages, not when there's just a single one.
Even though schemaFormat
is correctly set, I get this unexpected InvalidTypeError .
I previously reported this as asyncapi/parser-js#1101, but the problem cause seems to be in the component.
The transformation step during schema parsing using the @openapi-contrib/openapi-schema-to-json-schema
module modifies the input OpenAPI schema, triggering a bug when the schema is parsed multiple times.
On first pass, schemas with nullable get modified:
type: ["string"] , nullable: true
to
type: ["string", "null"]
When this is then parsed again (the same schema is also referenced from another location), the transformation fails with the InvalidTypeError
because it doesn't expect a type array in its input.
Expected behavior
AsyncAPI being parsed without error, with schemas interpreted using OpenAPI 3.0 format.
Screenshots
Error thrown during AsyncAPI document parsing. Name: InvalidTypeError, message: Type ["string","null"] is not a valid type, stack: undefined
How to Reproduce
🖥️ Device Information [optional]
I've tested this using the parser code directly (jest test), using AsyncAPI Studio and the VS Code extension.
👀 Have you checked for similar open issues?
- I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue ?
Yes I am willing to submit a PR!