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

feat: enable validation of AsyncAPI Spec v3 documents in validate command #780

Merged
merged 6 commits into from
Sep 14, 2023

Conversation

smoya
Copy link
Member

@smoya smoya commented Aug 31, 2023

Description

Fixes #770

This PR enables validation of AsyncAPI v3 documents through the validate command.
In order to not break model generation (that uses the future version of Parser-JS v3, which breaks the API), It uses a new independent library (https://github.com/smoya/multi-parser-js) that is temporarily needed for "downgrading" the parsed document to previous Parser-API version (v1.0.0) so it's aligned with the one in use by Modelina parser version. It is needed until asyncapi/modelina#1493 gets fixed

Related issue(s)
#770

cc @jonaslagoni

package.json Outdated
"@asyncapi/raml-dt-schema-parser": "^4.0.3",
"@asyncapi/studio": "^0.17.3",
"@oclif/core": "^1.26.2",
"@oclif/errors": "^1.3.6",
"@oclif/plugin-not-found": "^2.3.22",
"@smoya/multi-parser": "^2.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

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

This lib can eventually go into AsyncAPI org, it is just a matter of starting the "donation" process.

package.json Outdated
@@ -16,12 +16,13 @@
"@asyncapi/modelina": "^1.9.0",
"@asyncapi/openapi-schema-parser": "^3.0.3",
"@asyncapi/optimizer": "^0.2.1",
"@asyncapi/parser": "^2.1.0",
"@asyncapi/parser": "^3.0.0-next-major-spec.1",
Copy link
Member Author

Choose a reason for hiding this comment

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

We have two options as far as I can see here:

  1. Hold this PR until the Parser-JS v3 version gets released, then upgrade to that version and merge.
  2. As Studio did already, work with the pre-release version.

I vote for the second option (as Studio did) so we can enable that ASAP, give value to the users who might want to play with Spec v3 now and also help us finding possible bugs in our tooling.

Owners should decide here.

Copy link
Member

Choose a reason for hiding this comment

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

I'd go for the second option too 👍

test/commands/validate.test.ts Outdated Show resolved Hide resolved
test/valid-specification-latest.yml Outdated Show resolved Hide resolved
@smoya
Copy link
Member Author

smoya commented Sep 12, 2023

@Shurtu-gal I fixed the tests location.

Copy link
Collaborator

@Shurtu-gal Shurtu-gal left a comment

Choose a reason for hiding this comment

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

Test folder LGTM 🚀

Souvikns
Souvikns previously approved these changes Sep 13, 2023
@@ -0,0 +1 @@
{"store":{}}
Copy link
Member Author

Choose a reason for hiding this comment

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

Is this needed @Souvikns ?

Copy link
Member

Choose a reason for hiding this comment

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

I think we can add it to the gitignore

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

@sonarcloud
Copy link

sonarcloud bot commented Sep 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@smoya
Copy link
Member Author

smoya commented Sep 14, 2023

/rtm

@asyncapi-bot asyncapi-bot merged commit 9590650 into asyncapi:master Sep 14, 2023
11 checks passed
@smoya smoya deleted the feat/supportV3Validation branch September 14, 2023 09:51
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.56.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI: validate command should validate AsyncAPI Spec v3 documents
5 participants