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: enable reusability of schemas between versions #468

Merged
merged 10 commits into from
Feb 21, 2024

Conversation

devilkiller-ag
Copy link
Member

Description
Adding functionality to share these schemas to all versions:

  • avroSchema_v1
  • openapiSchema_3_0

Related issue(s)
Fixes #364

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@devilkiller-ag
Copy link
Member Author

This work is still in progress. I will update the tools/bundler/index.js soon to adapt these changes.

@devilkiller-ag
Copy link
Member Author

devilkiller-ag commented Dec 15, 2023

Hi @jonaslagoni, The IIFE in the tools/bundler/index.js uses asyncapi.json of every version as fileToBundle. Why is it used for? And since the common folder will not have such a file, what should I use for fileToBundle? Or will I have to write a different implementation for this folder? I am sorry, I have a little blurry understanding of bundler and spec-json-schemas. Is there any resource which can help me to develop an understanding of this?

@jonaslagoni
Copy link
Member

Hi @jonaslagoni, The IIFE in the tools/bundler/index.js uses asyncapi.json of every version as fileToBundle. Why is it used for?

It is the entry point for bundling, all references therein is being bundled recursively.

And since the common folder will not have such a file, what should I use for fileToBundle? Or will I have to write a different implementation for this folder? I am sorry, I have a little blurry understanding of bundler and spec-json-schemas. Is there any resource which can help me to develop an understanding of this?

The only changes you would need is something along the lines of; create a function for loadingCommonSchemas, which loops over all the files in the common folder, and adds them to the bundler memory. Similar to how the bindings are added:

async function loadBindings(bundler) {

Thats it. The rest of the bundler code should function fine after that.

Copy link

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@devilkiller-ag
Copy link
Member Author

Hi @jonaslagoni, I am sorry for ghosting this PR. I will complete the work on it this weekend.

@devilkiller-ag devilkiller-ag marked this pull request as ready for review January 31, 2024 08:19
@devilkiller-ag
Copy link
Member Author

Hi @jonaslagoni! Sorry for the delay. This PR is ready for review now!

@devilkiller-ag
Copy link
Member Author

@jonaslagoni Any updates regarding this PR?

@jonaslagoni
Copy link
Member

@devilkiller-ag you need to have the codeowners to look at it ✌️

@devilkiller-ag
Copy link
Member Author

@jonaslagoni Got it✨

@devilkiller-ag
Copy link
Member Author

Hi @derberg @fmvilas @smoya @dalelane @char0n, can you review this PR ✨

Copy link

sonarqubecloud bot commented Feb 8, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@devilkiller-ag
Copy link
Member Author

Hi @smoya, Can you please review this PR again?

Copy link
Member

@smoya smoya left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀🌔

@smoya
Copy link
Member

smoya commented Feb 20, 2024

/rtm

@smoya
Copy link
Member

smoya commented Feb 21, 2024

/rtm

@asyncapi-bot asyncapi-bot merged commit a444ea4 into asyncapi:master Feb 21, 2024
12 checks passed
@devilkiller-ag devilkiller-ag deleted the ag-dev branch February 21, 2024 12:30
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 6.5.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.

Enable reusability of schemas between versions
4 participants