Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Any non supported schema format should not make the doc invalid #1066

Open
2 tasks done
smoya opened this issue Nov 21, 2024 · 0 comments
Open
2 tasks done

[BUG] Any non supported schema format should not make the doc invalid #1066

smoya opened this issue Nov 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@smoya
Copy link
Member

smoya commented Nov 21, 2024

Describe the bug.

Current supported schema formats are available in https://www.asyncapi.com/docs/reference/specification/v3.0.0#multiFormatSchemaObject.

If we try to parse a document containing an schema with, for example, schemaFormat: "application/octet-stream", the parser gives a validation error: Unknown schema format.

E.g.

Error thrown during AsyncAPI document parsing. Name: Error, message: Unknown schema format, stack: Error: Unknown schema format\n'

However, we find the following statement in the spec (same link as above):

Custom values are allowed but their implementation is OPTIONAL.

Expected behavior

Even though no custom schema parser is found for a given schema format, the document should still be valid as long as it is a string

Screenshots

CleanShot 2024-11-21 at 17 19 36@2x

How to Reproduce

import { Parser } from "@asyncapi/parser";
const parser = new Parser();
const { document, diagnostics } = await parser.parse(`
asyncapi: 3.0.0
info:
  title: Test custom schema format
  version: 0.1.0
components:
  schemas:
    theSchema:
      schemaFormat: application/octet-stream # This is allowed by the spec
      schema: true
`);

if (document) {
  console.log(document.info().title());
} else {
  console.log(diagnostics);
}

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

@smoya smoya added the bug Something isn't working label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant