-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Refine AsyncAPI Bundling with Origin Tracing and Component Naming #141
Comments
Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request. |
@aeworxet, thanks for pinging me on this issue again! The solution in point 2 (x-origin) does not cover my use case. I want refs to be bundled like they were defined in the common components of the AsyncAPI. By doing so, all tools that display AsyncAPIs would automatically display the name of the previously external component without additional work. By adding a new property I've created a small example repo to demonstrate how it works with OpenAPI tooling: https://github.com/thake/openapi_bundling/tree/main |
@thake Is this what you meant? Transform this
Into this
? |
Correct, thanks for the asyncAPI example |
@KhudaDad414 Does @thake's request imply a rewriting of point 2 of the task and provide the direction in which point 4 should be solved? |
@thake I see what you mean. so basically we have two options here: @aeworxet what do you think? cc: @derberg |
I have taken a look at the way Original ...
message:
$ref: './messages.yaml#/messages/UserSignedUp'
... After ...
message:
x-origin: './messages.yaml#/messages/UserSignedUp'
payload:
type: object
properties:
displayName:
type: string
description: Name of the user
... After ...
message:
$ref: '#/components/messages/UserSignedUp'
... ...
components:
messages:
UserSignedUp:
x-origin: './messages.yaml#/messages/UserSignedUp'
payload:
type: object
properties:
displayName:
type: string
description: Name of the user
... @thake Does this clarification still reflect what you meant? |
About the new flag. Given that there are already flags I have two variants: Which one would everyone choose? |
In light of the release of the AsyncAPI Specification 3.0.0, should points 3 and 4 regarding |
@aeworxet what about changing
I don't see why would points 3 and 4 would treat v2 and v3 differently. 🤔 |
I am concerned about @Souvikns already had to introduce changes to the Might it be necessary to implement something similar for the I would of course do a recursive search by mask so as not to depend on version changes, but still. |
yup, best if flow is @aeworxet not sure why are you concerned about v2 vs v3 sorry if my answer do not address the question, I might not get it. I also forgot a lot from initial discussion and focused on other stuff, sorry |
@aeworxet you added it to bounty, but tbh it is not |
@aeworxet your point is valid for the master branch. but asyncapi/optimizer#193 is going to change the implementation so it uses parser-js. no issues there. |
Bounty Issue's service commentText labels: |
As an AsyncAPI Maintainer, I fall under the first category in the prioritization list, so I assign this issue to myself. |
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. |
Is there a date when asyncapi/optimizer#193 is expected to be merged? I would prefer to first add functionality to the Would renaming |
The work is done. it will be merged after I get a green light from @derberg
yes, it is a breaking change. but since we haven't released v1 yet. I am not worried about breaking stuff. 🤷 |
@asyncapi/bounty_team |
According to the user's real-world testing, the code in PRs #147 and asyncapi/optimizer#216 works flawlessly. |
There are no immediate bugs opened on the newly added functionality, so this issue is completed. |
After a technical delay with merges of the PRs, which was beyond the control of the Bounty Program Participant Bounty Issue Completed 🎉@aeworxet, please go to the AsyncAPI page on Open Collective and submit an invoice for |
Context
#97
Summary:
Integrating the
optimizer
andbundler
to enhance user experience requires a few modifications. These include removing redundant features, tracing the origins of references, and improving naming conventions within the bundled output.Detailed Steps:
1) Simplify the Bundler by Removing
referenceIntoComponents
:The
referenceIntoComponents
feature in the bundler seems to belong to the optimizer. Its removal should be straightforward:referenceIntoComponents
flag is utilized.2) Traceability of
$ref
Origins Post-Bundling:To maintain a clear lineage of
$ref
components post-bundling, it's necessary to include anx-origin
property. This will annotate where the original$ref
was located in the source files.For example, transform this:
Into this:
3) Introduction of a New Flag in the
optimizer
:We propose adding a flag to the
optimizer
to centralize all components under thecomponents
section of an AsyncAPI document. The proposed flag ismoveAllComponents
. Alternative suggestions for the flag name are welcome for better intuitiveness.4) Intelligent Component Naming in the
optimizer
:With the
x-origin
in place, theoptimizer
should leverage it to assign meaningful names to components, falling back to a standard naming convention (e.g.,message-1
) only when a better name isn't discernible from the context.For instance, utilizing
UserSignedUp
derived fromx-origin
instead of a genericmessage-1
.The text was updated successfully, but these errors were encountered: