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

Generate channel type #982

Open
mcoevert opened this issue Nov 1, 2022 · 6 comments
Open

Generate channel type #982

mcoevert opened this issue Nov 1, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@mcoevert
Copy link

mcoevert commented Nov 1, 2022

Reason/Context

To ensure only channels allowed in the schema are being used, generating a type of available channels would be very nice.

For example:

channels:
  channelOne:
    ...
  channelTwo:
    ...

Expected outcome:

type Topics = "channelOne" | "channelTwo";
@mcoevert mcoevert added the enhancement New feature or request label Nov 1, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2022

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.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@jonaslagoni
Copy link
Member

Thanks for the issue @mcoevert!

Somewhat related to #181

This is possible to do with a bit of custom code, by combining pre-parsing the AsyncAPI document you are able to iterate over the channels and create your own Enum MetaModel, and provide it to a generator.

Maybe it would make sense to add this behavior to the AsyncAPI processor and enable it through an option such as includeChannelModels 🤔 What do you think?

@PanMan
Copy link
Contributor

PanMan commented Nov 9, 2022

(I'm a colleague of @mcoevert ) - we have for now done this ourselves in the generate script, but I do think it would make sense to have this be included...

@jonaslagoni
Copy link
Member

jonaslagoni commented Nov 10, 2022

Definitely a good request, just gonna leave this open 🙂

@PanMan you are more than welcome to provide a PR with this, I think we could include it here:

for (const message of doc.allMessages()) {

And create a new processor option to switch it on and off 🤔

What do you think?

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@github-actions github-actions bot added the stale label Mar 11, 2023
@jonaslagoni
Copy link
Member

jonaslagoni commented Jun 24, 2023

Because this IS enabled by using the core meta model as inputs, I am going ahead and close this issue. As it is unlikely we are going to enable this even further natively in Modelina. Unless someone wants to champion this.

See https://modelina.org/examples?selectedExample=meta-model

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants