-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
SwaggerEditor@next: add initial support for AsyncAPI 3.x #4872
Labels
Comments
These are ad-hoc parser adapters that will allow to properly detect AsyncAPI 3.x definitions. const asyncApi3JSONMatch = content.match(
/"asyncapi"\s*:\s*"(?<version_json>3\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))"/
);
if (asyncApi3JSONMatch !== null && fn.isValidJSONObject(content)) {
const { groups } = asyncApi3JSONMatch;
const version = groups?.version_json;
const contentType = `application/vnd.aai.asyncapi+json;version=${version}`;
return editorActions.detectContentTypeSuccess({ contentType, content, requestId });
}
const asyncApi3YAMLMatch = content.match(
/(?<YAML>^(["']?)asyncapi\2\s*:\s*(["']?)(?<version_yaml>3\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))\3(?:\s+|$))|(?<JSON>"asyncapi"\s*:\s*"(?<version_json>3\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))")/m
);
if (asyncApi3YAMLMatch !== null && fn.isValidYAMLObject(content)) {
const { groups } = asyncApi3YAMLMatch;
const version = groups?.version_json ?? groups?.version_yaml;
const contentType = `application/vnd.aai.asyncapi+yaml;version=${version}`;
return editorActions.detectContentTypeSuccess({ contentType, content, requestId });
} |
Resolved by #4886 |
char0n
added a commit
that referenced
this issue
Mar 29, 2024
swagger-bot
pushed a commit
that referenced
this issue
Mar 29, 2024
# [5.0.0-alpha.92](v5.0.0-alpha.91...v5.0.0-alpha.92) (2024-03-29) ### Features * **editor-preview-asyncapi:** add initial support for AsyncAPI 3.0.0 ([#4886](#4886)) ([1626243](1626243)), closes [#4872](#4872) * **top-bar:** add support for loading AsyncAPI Petstore 3.0.0 example ([#4888](#4888)) ([a81bebf](a81bebf)), closes [#4873](#4873) * **top-bar:** add support for loading AsyncAPI Streetlights 3.0.0 example ([#4887](#4887)) ([902f580](902f580)), closes [#4874](#4874)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The goal of this issue is to add initial support for AsyncAPI 3.x. What does this initial support consist of?
1. Ability to editor AsyncAPI 3.x definitions
We must allow to edit AsyncAPI 3.x definitions. ApiDOM Language Service will not recognize it and will not provide syntax highlighting, auto-completion, documentation - this will not prevent for effectively editing the AsyncAPI 3.x definitions.
2. Rendering AsyncAPI 3.x definitions
By updating AsyncAPI tooling in #4585, we're now able to render AsyncAPI 3.x definitions.
3. Validation of AsyncAPI 3.x definitions
By updating AsyncAPI tooling in #4585, AsyncAPI parser now comes with Spectral which provides official AsyncAPI ruleset. AsyncAPI SwaggerEditor@5 preview plugin integrates with Spectral and translates the spectral diagnostics to Monaco Editor markers. This brings almost complete validation experience within the initial AsyncAPI 3.x support.
The text was updated successfully, but these errors were encountered: