asyncapi / spec-json-schemas

AsyncAPI schema versions
Apache License 2.0
56 stars 54 forks source link

refactor: enable reusability of schemas between versions #468

Closed devilkiller-ag closed 9 months ago

devilkiller-ag commented 11 months ago

Description Adding functionality to share these schemas to all versions:

Related issue(s) Fixes #364

devilkiller-ag commented 11 months ago

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

devilkiller-ag commented 11 months ago

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 commented 11 months ago

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: https://github.com/asyncapi/spec-json-schemas/blob/287ed2846a764ac6ffce1d5034a9e3e47853a247/tools/bundler/index.js#L44

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

sonarcloud[bot] commented 11 months ago

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 commented 10 months ago

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

devilkiller-ag commented 10 months ago

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

devilkiller-ag commented 10 months ago

@jonaslagoni Any updates regarding this PR?

jonaslagoni commented 10 months ago

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

devilkiller-ag commented 10 months ago

@jonaslagoni Got it✨

devilkiller-ag commented 9 months ago

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

sonarcloud[bot] commented 9 months ago

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 commented 9 months ago

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

smoya commented 9 months ago

/rtm

smoya commented 9 months ago

/rtm

asyncapi-bot commented 9 months ago

:tada: This PR is included in version 6.5.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: