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

refactor: changing input processor and interpreter to support more schemas #377

Merged
merged 27 commits into from
Sep 22, 2021

Conversation

jonaslagoni
Copy link
Member

@jonaslagoni jonaslagoni commented Sep 17, 2021

Description
As more input schemas are to be supported, we need to split out the schemas even more than we are now.

The changes:

  • It removes the generic Schema and CommonSchema completely and introduces the more specific Draft7Schema and AsyncapiV2Schema.
  • It changes the originalSchema property from the CommonModel to originalInput - see originalSchema for CommonModel should be called originalInput #86
  • Refactored the toX functions for Draft7Schema and CommonModel to be more generic, I did not find any way to generalize it anymore between them, so if you have any suggestion, let me know 🙏

Related issue(s)
Related to #360
Fixes #86

@coveralls
Copy link

coveralls commented Sep 17, 2021

Pull Request Test Coverage Report for Build 1261433956

  • 194 of 201 (96.52%) changed or added relevant lines in 20 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 93.299%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/models/CommonModel.ts 53 55 96.36%
src/processors/JsonSchemaInputProcessor.ts 33 38 86.84%
Totals Coverage Status
Change from base Build 1261424794: -0.08%
Covered Lines: 1953
Relevant Lines: 1995

💛 - Coveralls

@jonaslagoni
Copy link
Member Author

@magicmatatjahu we can ignore the bug as #379 removes it.

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

@jonaslagoni I understand that we are still sticking with CommonModel etc? Will this be changed in the future?

Refactored the toX functions for Draft7Schema and CommonModel to be more generic, I did not find any way to generalize it anymore between them, so if you have any suggestion, let me know 🙏

It seems like too much boilerplate to me, but it would take a lot of work to change it and that's the easiest way to do it now... 😅

Also, you have one bug in sonar cloud.

@sonarqubecloud
Copy link

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.1% 0.1% Duplication

@jonaslagoni
Copy link
Member Author

jonaslagoni commented Sep 22, 2021

@jonaslagoni I understand that we are still sticking with CommonModel etc? Will this be changed in the future?

@magicmatatjahu for now, however I have started to rework that part, but it is a WIP, as I still need test different things before making some noise around it - #365 (comment)

It seems like too much boilerplate to me, but it would take a lot of work to change it and that's the easiest way to do it now... 😅

Yea, exactly, dont have any better alternative at the moment. At least I dont see it.

Copy link
Member

@magicmatatjahu magicmatatjahu left a comment

Choose a reason for hiding this comment

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

LGTM :)

@jonaslagoni jonaslagoni merged commit 1093113 into asyncapi:master Sep 22, 2021
@jonaslagoni jonaslagoni deleted the feature/refactor_input branch September 22, 2021 13:23
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.31.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
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

originalSchema for CommonModel should be called originalInput
4 participants