-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
refactor: integrate custom schemas with parser and spectral #579
refactor: integrate custom schemas with parser and spectral #579
Conversation
ef8a4d4
to
0826afe
Compare
6aad643
to
7676c9e
Compare
@@ -62,6 +67,6 @@ export async function parseSchemasV2(parser: Parser, detailed: DetailedAsyncAPI) | |||
} | |||
|
|||
async function parseSchemaV2(parser: Parser, item: ToParseItem) { | |||
item.value[xParserOriginalSchemaFormat] = item.input.schemaFormat; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you are removing it but I can't see where we add xParserOriginalSchemaFormat
value back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't remove schemaFormat from message in custom parsers so we don't need to set it the extension. Is it clear?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then we need remember to modify the README as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I will change it! :)
if (spectral instanceof Spectral) { | ||
this.spectral = spectral; | ||
} else { | ||
this.spectral = new Spectral(spectral); | ||
} | ||
|
||
// TODO: fix type | ||
this.spectral.setRuleset(aasRuleset as any); | ||
this.registerSchemaParser(AsyncAPISchemaParser()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now register the other ones as all have been merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. As current solution, people need to register given format manually. For example, RAML works only on nodejs, so register RAML here will break browser compability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's right! 👍 thanks
dd89a9f
to
9b1838b
Compare
Kudos, SonarCloud Quality Gate passed! |
recommended: true, | ||
given: [ | ||
// operations | ||
'$.channels.*.[publish,subscribe].message', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized all those paths are tied to AsyncAPI Spec v2.x.x. How would we make it happen for v3.x.x ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By separate function, we can use different "formats" for rules in this same rulesets - one function for v2, another one for v3. Don't worry :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great job @magicmatatjahu 💯 🚀 🌔
/rtm |
Description
cc @smoya
Related issue(s)
Part of #482