Skip to content

fix: allow unknown custom schema formats without validation errors - #1218

Merged
asyncapi-bot merged 7 commits into
asyncapi:masterfrom
AayushSaini101:1066
Aug 8, 2026
Merged

fix: allow unknown custom schema formats without validation errors#1218
asyncapi-bot merged 7 commits into
asyncapi:masterfrom
AayushSaini101:1066

Conversation

@AayushSaini101

Copy link
Copy Markdown
Collaborator

That rejected valid documents that use custom schema formats without a registered schema parser.

Changes

  • Skip schema validation when no registered parser matches the given schemaFormat
  • Return the schema as-is during parse for unknown custom formats
  • Require schemaFormat to be a string; reject non-string values
  • Add tests for custom formats such as application/octet-stream and Avro without a registered parser

Related issue

Closes #1066

Test plan

  • Parse a v3 document with schemaFormat: "application/octet-stream" and confirm it succeeds
  • Parse a document with an unknown string schemaFormat and confirm no Unknown schema format diagnostic
  • Confirm registered formats (e.g. AsyncAPI JSON Schema) still validate as before
  • Confirm non-string schemaFormat is rejected

AayushSaini101 and others added 2 commits August 6, 2026 14:59
Co-authored-by: Cursor <cursoragent@cursor.com>
Preserve unknown custom schema formats as-is when schemaFormat is a
string, and reject non-string values instead of treating them as valid.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7dd5257

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/parser Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

},
] as SchemaValidateResult[];
}
return [];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

how about if we emit an info/warning diagnostic like: "No schema parser registered for..."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added warning and updated the flow thanks

Comment thread packages/parser/src/schema-parser/index.ts Outdated
Comment thread packages/parser/test/custom-operations/parse-schema-v3.spec.ts
Comment thread packages/parser/src/schema-parser/index.ts Outdated
@github-actions github-actions Bot added the microgrant Participation in the Microgrant Program label Aug 7, 2026
@aeworxet

aeworxet commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@asyncapi/microgrant_team

@aeworxet aeworxet moved this to In Progress in Microgrant Program Aug 7, 2026
AayushSaini101 and others added 2 commits August 7, 2026 11:32
Emit a warning diagnostic when no schema parser is registered, drop
unreachable non-string guards, and cover the asyncapi#1066 components.schemas
reproduction.

Co-authored-by: Cursor <cursoragent@cursor.com>

@princerajpoot20 princerajpoot20 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@princerajpoot20

Copy link
Copy Markdown
Member

/rtm

@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

@asyncapi-bot
asyncapi-bot merged commit 76eaf49 into asyncapi:master Aug 8, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Completed in Microgrant Program Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

microgrant Participation in the Microgrant Program ready-to-merge

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

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

4 participants