Repository navigation
Description
Context
@smoya/multi-parser is a library that allows users to parse an AsyncAPI document and get an output model based on a desired Parser-API version. Additionally, it allows to convert models from one Parser-API version to another.
This tool is required by some AsyncAPI tools that use the Parser-JS and have to send the parsed document model to another library, which could be compatible with a different Parser-API version than the one used in that particular version of the Parser-JS.
You have several examples of usage here:
- CLI, to send the right parsed model to Modelina when Modelina didn't have support for Parser-JS v3: https://github.com/asyncapi/cli/blob/master/src/commands/generate/models.ts#L186C29-L186C77
- Modelina, to ensure any AsyncAPI model input uses the right Parser-API version, so it can accept any Parser-API v1, v2, v3... model as input: https://github.com/asyncapi/modelina/blob/master/src/processors/AsyncAPIInputProcessor.ts#L68-L69
- Modelina, to instantiate a Parser compatible with a particular Parser-API version: https://github.com/asyncapi/modelina/blob/master/src/processors/AsyncAPIInputProcessor.ts#L72
Current issues
1. 👤 Ownership
@smoya/multi-parser is a library hosted in a GH repository under my particular ownership (@smoya). Not a big issue per se, but I don't wanna be the only maintainer of such a tool. I thought on donating this to AsyncAPI org (TSC would need to vote first) but the reality is that won't be needed, see next point:
2. 🔃 Release is not in sync with Parser-JS
Every new Parser-JS release is not triggering an update on the @smoya/multi-parser. I agree I could configure a bot like Renovate (Dependabot doesn't allow NPM package aliases, and this package makes use of them) to try update those.
But still we have two issue with that situation:
- Whenever a new major Parser-API version gets released, the need of small additions into the @smoya/multi-parser code will be needed. See https://github.com/smoya/multi-parser-js/blob/main/src/parse.ts#L45-L53. Could we automate it somehow by changing the code? Perhaps yes, but not ideal and probably not trustable in the long term. At this moment, this includes manual work and be always careful when a new version goes out.
- For a certain period of time after a new release of Parser-JS, @smoya/multi-parser will be outdated and users of the library who also use Parser-JS as dependency could have runtime errors due to not using the same version of the models (different Parser-JS versions!). Of course, solved when Renovate updates in case it's not a major Parser-API version change.
The solution I propose
To integrate @smoya/multi-parser code into the Parser-JS repository, and to release two packages on each Parser-JS release:
@asyncapi/parser, the current one that is already happening.@asyncapi/multi-parser, this a new one.
In that way, everything gets in sync, and also, by adding tests, we could ensure new versions of the Parser-JS are working with the @asyncapi/multi-parser package. The same when we adopt a new version of the Parser-API in the Parser-JS, support in @asyncapi/multi-parser will be added in the same PR.
That means, we should have a monorepo model in this repository.
Due to the fact @asyncapi/multi-parser has as dependency the Parser-JS but not only once, but once for each Parser-API version (atm 3 aliased Parser-JS deps pointing to different version of the Parser-JS), plus the fact the library will be used only by few particular libraries and most users won't need it ever, @asyncapi/multi-parser should be released completely as a separate package.
Examples of monorepo within AsyncAPI can be found here:
- https://github.com/asyncapi/asyncapi-react
- https://github.com/asyncapi/studio
Some discussions in Slack about that topic:
- https://asyncapi.slack.com/archives/CQVJXFNQL/p1708604139253399
- https://asyncapi.slack.com/archives/CQVJXFNQL/p1710238071506779
BTW, since @smoya/multi-parser is under Apache 2.0 license, copying code right directly into the Parser-JS is completely legal, and since Parser-JS uses the same license, no need to specify any atribution of change on the license. So no need to even first do the donation to AsyncAPI GH org :) Additionally, I'm giving my written approval to do whatever is needed with that code so it can be integrated into the Parser-JS. Once that's done, and all dependants update to @asyncapi/multi-parser, I will completely archive @smoya/multi-parser in favor of @asyncapi/multi-parser.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsCompleted
Activity
jonaslagoni commentedon Mar 14, 2024
Makes sense to me 👍
aeworxet commentedon Mar 18, 2024
Bounty Issue's service comment
Text labels:
bounty/2024-Q2,bounty/advanced,bounty/codingFirst assignment to third-party contributors: 2024-03-22 00:00:00 UTC+12:00
End Of Life: 2024-08-31 23:59:59 UTC-12:00
@asyncapi/bounty_team
Vishal2002 commentedon Mar 20, 2024
@smoya I think you should ask the Asyncapi org to add this issue under GSOC 2024 idealist. It would be a good contribution to have in the parser-js.
smoya commentedon Mar 20, 2024
This is part now of the AsyncAPI Bounty Program 2024 Q2. Additionally, the GSOC 2024 ideas submission period finished last month, and we got accepted.
derberg commentedon Mar 20, 2024
@smoya if that works, I guess we can start thinking about pulling other projects inside parser-js for better maintainance and cooperation - like avro, protobuf, openapi and raml data parsers?
and then we can also work on something that @jonaslagoni brought up in past, that DX of using parser with schema parsers is hard, so we could enable publishing of parser-js on steroids, with schema parsers included by default (while still publishing parser alone of course, lightweight for web)
smoya commentedon Mar 20, 2024
It makes sense to me, yeah.
+1. I wasn't aware of this suggestion but i really like it. I've found myself involved in the issue of having to manually load the schema parsers all the time so I believe it will be so helpful for lot of users who just want everything to work at once.
derberg commentedon Mar 20, 2024
yeah, I see the same with
semantic-versioningthat at some point of time, decided to include in main package a number of default, more used plugins - so managing dependencies is now much much betterVishal2002 commentedon Mar 20, 2024
I want to give a try to this issue and want to work on it.
smoya commentedon Mar 20, 2024
Hi @Vishal2002, thanks for showing interest. Let's wait at least a day since more contributors could jump in as well.
As per the Bounty rules:
In your case, you fall under the third category.
Toyin5 commentedon Mar 20, 2024
@smoya I want to work on this issue
smoya commentedon Mar 20, 2024
Same answer as the one I provided to @Vishal2002 in #963 (comment)
12 remaining items
aeworxet commentedon Apr 18, 2024
Bounty Issue's Timeline
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.
smoya commentedon Jun 5, 2024
Due to the fact Ci has been broken since long ago (we were not aware), and considering it took me some time (days) figuring out the reason, I believe @ayushnau should request an extension of 1 week for this Bounty Program delivery.
cc @aeworxet
aeworxet commentedon Jun 6, 2024
Upon request of the AsyncAPI Maintainer, who is responsible for the resolution of the Bounty Issue from the AsyncAPI's side (@smoya), all remaining target dates of the Bounty Issue's Timeline are extended by one calendar week.
Bounty Issue's Timeline Extended
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.
ayushnau commentedon Jun 21, 2024
@aeworxet @smoya
I am writing to inform you of a recent change in our release process for the GitHub action. The release process, which was previously managed using semantic release, has now been transitioned to changeset. This unexpected shift has caused some delays, as I was not fully prepared for the new process. Consequently, I kindly request an extension of two weeks to accommodate this transition and ensure a smooth and accurate release.
Thank you for your understanding and consideration.
smoya commentedon Jun 21, 2024
I agree the uncertainty nature of this issue, the knowns VS unknowns, and the several areas this issue affects (code, CI, CD) makes a difficult and, somehow, unpredictable one.
Even though we had a model to follow (Studio case), we (including me as maintainer) did assumptions wrongly; later found we were missing some changes such as the replacement of semantic-release by changesets (a change that it is not so obvious) and how that change affects our release pipeline.
Being honest, I had some doubts few days ago if this task should be given an extension or not, but atm I truly believe it should get it.
@aeworxet has the last words.
aeworxet commentedon Jun 21, 2024
Upon request of the Bounty Program Participant (@ayushnau), all remaining target dates of the Bounty Issue's Timeline are extended by two calendar weeks.
Bounty Issue's Timeline Extended
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.
smoya commentedon Jul 23, 2024
@ayushnau After merging #1036 and related PRs, the release of both packages happened. I tested the
@asyncapi/parser(basic stuff) and seems to work, however, when running a simple test for the@asyncapi/multi-parser, the following errors appears:ayushnau commentedon Jul 25, 2024
@smoya working on it. will update you once i fix it.
smoya commentedon Aug 2, 2024
This issue is now technically solved. Thanks @ayushnau for your work!
Cc @aeworxet
aeworxet commentedon Aug 2, 2024
After a set of delays that were beyond the control of the Bounty Program Participant
#1036 (comment)
#1036 (comment)
#1036 (comment)
#1036 (comment)
#1036 (comment)
#1036 (review)
#1036 (comment)
#963 (comment)
Bounty Issue Completed 🎉
@ayushnau, please go to the AsyncAPI page on Open Collective and submit an invoice for
USD 400.00with the expense titleBounty parser-js#963, tagbounty, and full URL of this Bounty Issue in the description.