-
-
Notifications
You must be signed in to change notification settings - Fork 96
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!: add schema union support #785
feat!: add schema union support #785
Conversation
@jonaslagoni You shouldn't remove the EDIT: Ok, you removed from message trait - but if there's a possibility to have that value in v2 message's trait, the v2 should return that, in v3 we should return |
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.
Looks good to me in general. Left a minor comment.
const payloadIsSchemaUnion = this._json.payload.schemaFormat !== undefined; | ||
return payloadIsSchemaUnion ? this._json.payload.schemaFormat : getDefaultSchemaFormat(this._meta.asyncapi.semver.version); |
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.
const payloadIsSchemaUnion = this._json.payload.schemaFormat !== undefined; | |
return payloadIsSchemaUnion ? this._json.payload.schemaFormat : getDefaultSchemaFormat(this._meta.asyncapi.semver.version); | |
const payloadIsSchemaUnion = this._json.payload?.schemaFormat !== undefined; | |
return payloadIsSchemaUnion ? this._json.payload.schemaFormat : getDefaultSchemaFormat(this._meta.asyncapi.semver.version); |
I think payload
can be undefined, right? We should be careful then.
schema: AsyncAPISchemaObject | ReferenceObject | any; | ||
} | ||
|
||
export type AllSchemaObjects = MultiFormatSchemaObject | AsyncAPISchemaObject | ReferenceObject | any; |
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.
About naming: asyncapi/spec-json-schemas#370 (comment)
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.
Looks pretty good to me! Just few changes that are needed. Including the one @fmvilas requested in https://github.com/asyncapi/parser-js/pull/785/files#r1242462994
I'm taking over this one as @jonaslagoni is 🌴 🏖️ |
Required Parser-API changes are now in the following PR asyncapi/parser-api#100 |
Kudos, SonarCloud Quality Gate passed! |
Since this PR has been opened for a while and lot of changes come from cc @jonaslagoni |
Description
This PR adds support for schema union support.
Related issue(s)
Related to asyncapi/spec#622
Fixes #809