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!: validate Avro schemas included in AsyncAPI docs #96

Merged
merged 3 commits into from
Nov 22, 2021

Conversation

dalelane
Copy link
Collaborator

This commit adds validation to the avro-schema-parser so that
invalid Avro schemas will be rejected.

I had to fix a few invalid Avro schemas in the tests (which were
using the type 'uuid' which isn't in the Avro spec) so this should
potentially be considered a major breaking change to the parser.

Closes: #37

Signed-off-by: Dale Lane dale.lane@uk.ibm.com

JQrdan
JQrdan previously approved these changes Nov 15, 2021
Copy link

@JQrdan JQrdan left a comment

Choose a reason for hiding this comment

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

This looks good! Thanks @dalelane

to-json-schema.js Outdated Show resolved Hide resolved
@magicmatatjahu
Copy link
Member

For me is ok, but I'm not a Codeowner so you need to wait for @derberg @fmvilas or @M3lkior

@M3lkior
Copy link
Collaborator

M3lkior commented Nov 17, 2021

For me is ok, but I'm not a Codeowner so you need to wait for @derberg @fmvilas or @M3lkior

Sorry, i will work on this tomorrow :)

@derberg
Copy link
Member

derberg commented Nov 17, 2021

@dalelane I see a remark about breaking change. Basically, we are afraid that enabling validation can cause failing parsing for others?

the Avro parser is already used by many, and in production, and is in a good shape. We can release 1.0 imho.

So even if we are not 100% sure if it is a breaking feature, we can play safe

thoughts?

@dalelane
Copy link
Collaborator Author

@dalelane I see a remark about breaking change. Basically, we are afraid that enabling validation can cause failing parsing for others?

the Avro parser is already used by many, and in production, and is in a good shape. We can release 1.0 imho.

So even if we are not 100% sure if it is a breaking feature, we can play safe

thoughts?

yeah, I think that would be good

To be fair, I think the risk is very small - because if someone really did have an invalid Avro schema in this way, most other Avro tools/clients/libraries I'm aware of would've already rejected it.

But, there is a small chance that someone has a slightly-invalid Avro schema in an AsyncAPI doc that today would parse correctly - and upgrading the parser would cause it to no longer parse. The Avro schemas we had in the tests are examples of how that can happen, as I needed to fix them! :-)

@derberg
Copy link
Member

derberg commented Nov 17, 2021

Normally we do not treat these things as breaking changes. For example, the main JS Parser doesn't have 100% validation coverage, and when we add new ones, like tags validation and at some point of time examples validation, we do not make a major release.

But yeah, here we are in this good position that we can actually do a major if we all think it is ok. Count on my vote

M3lkior
M3lkior previously approved these changes Nov 18, 2021
Copy link
Collaborator

@M3lkior M3lkior left a comment

Choose a reason for hiding this comment

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

@dalelane it could be nice to add a new section in the Features chapter in the README file to indicate that we now provide avro validation during the processing ?
Furthermore, if we decide to release as a breaking change version, don't forget to reword your rebased commit with the ! char, according to the conventionalcommits.org specification :)

@derberg
Copy link
Member

derberg commented Nov 18, 2021

yes, to release major, title must be feat!: validate Avro schemas included in AsyncAPI docs and make sure you merge&squash with the same commit message

This commit adds validation to the avro-schema-parser so that
invalid Avro schemas will be rejected.

I had to fix a few invalid Avro schemas in the tests (which were
using the type 'uuid' which isn't in the Avro spec) so this should
potentially be considered a major breaking change to the parser.

Closes: #37

Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
@dalelane dalelane changed the title feat: validate Avro schemas included in AsyncAPI docs feat!: validate Avro schemas included in AsyncAPI docs Nov 19, 2021
@dalelane
Copy link
Collaborator Author

added an explanation to README, and squashed-and-rebased
hopefully we're good to go now

M3lkior
M3lkior previously approved these changes Nov 19, 2021
@M3lkior
Copy link
Collaborator

M3lkior commented Nov 19, 2021

added an explanation to README, and squashed-and-rebased hopefully we're good to go now

Yep it seems ok for me :)

@dalelane
Copy link
Collaborator Author

@derberg brill, thanks - I've squashed and rebased, updated the commit title, and made the README change - think I just need a re-review please then we're good to go

@derberg
Copy link
Member

derberg commented Nov 22, 2021

@dalelane oh, sorry for misunderstanding, I just meant that when you will click button squash and merge you need to take care of these things, not that you need to do it on local 😅

anyway, tests hang there in the system and won't run. Could you push an empty commit maybe to trigger checks please

Signed-off-by: Dale Lane <dale.lane@uk.ibm.com>
@sonarcloud
Copy link

sonarcloud bot commented Nov 22, 2021

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

@dalelane dalelane merged commit dcbb195 into master Nov 22, 2021
@dalelane dalelane deleted the avro-validation branch November 22, 2021 12:50
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@derberg
Copy link
Member

derberg commented Nov 22, 2021

Congrats! please only remember folks that even though you are committers you should work on forks like every other contributor, not create branches in the upstream. I recommend this instruction to set up your fork to work with upstream seamlessly

@dalelane
Copy link
Collaborator Author

ah, I didn't realise - thanks for the heads-up, will do that next time

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.

Add Avro Schema Validation
6 participants