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

Integrage Modelina to provide type safety for message payloads in functions #391

Open
Tracked by #477
KhudaDad414 opened this issue Mar 3, 2023 · 8 comments
Open
Tracked by #477
Labels
enhancement New feature or request stale

Comments

@KhudaDad414
Copy link
Member

Reason/Context

One of the challenges I face when using Glee is the uncertainty of the values in message payloads. Seeing the "any" type in Typescript can also be a bit intimidating. 😆

However, AsyncAPI provides a helpful feature that allows us to describe the message payload format using JSON Schema. With the use of https://github.com/asyncapi/modelina, we can conveniently convert these schemas into Typescript Types.

Where to start?

Step 1

Use Modelina and generate the types from the AsyncAPI file. Categorize the message payload type by the operationId. for example we can have types/operations/hello.d.ts for hello operation in .glee folder.
It would be great for this file to contain the whole function type so it can be easily used in hello.ts function.

Step 2

When we generate a Glee project for an AsyncAPI file, Glee should create empty blueprints for all of the operations and assign the correct types to them. this way, user can start with the blueprint and get all of the type safety and suggestions for their message payloads.

@jonaslagoni I don't have that much experience with Modelina and not sure if it's feasible. WDYT? 🤔

@KhudaDad414 KhudaDad414 added the enhancement New feature or request label Mar 3, 2023
@SinghiHarsh
Copy link
Contributor

SinghiHarsh commented Mar 5, 2023

How about we create a CLI function to generate types on the go based on the operationId added or changed in AsyncAPI file. (Just a thought)

I’m looking to implement the idea of creating blueprint files for the message payloads in the AsyncAPI file during the generation of glee project.

@jonaslagoni
Copy link
Member

jonaslagoni commented Mar 6, 2023

That should definitely be possible yea 👍

In the early stages of Glee we also did this for Java, so you could have Glee functions in Java where the signature of the function was generated by Modelina, like you are proposing for TypeScript. So yea definitely possible 💯

Feel free to reach out if you have any questions or problems 🙂

@KhudaDad414
Copy link
Member Author

KhudaDad414 commented Mar 9, 2023

How about we create a CLI function to generate types on the go based on the operationId added or changed in AsyncAPI file. (Just a thought)

@SinghiHarsh I think @peter-rr is working on generating glee projects from an AsyncAPI file in cli(If I am not mistaken) I guess step 2 can be done there?

I’m looking to implement the idea of creating blueprint files for the message payloads in the AsyncAPI file during the generation of glee project.

that's great. 🌟 please reach out if you had any questions :)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 8, 2023

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 Jul 8, 2023
@KhudaDad414 KhudaDad414 mentioned this issue Jul 14, 2023
10 tasks
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 6, 2023
@KhudaDad414 KhudaDad414 reopened this Nov 6, 2023
@github-actions github-actions bot removed the stale label Nov 7, 2023
Copy link
Contributor

github-actions bot commented Mar 6, 2024

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 6, 2024
@AnimeshKumar923
Copy link
Contributor

@KhudaDad414 issue still valid?
cc: @jonaslagoni

@KhudaDad414
Copy link
Member Author

@AnimeshKumar923 This is a valid issue. To address it, we might need to implement this feature in two places:

The challenge is that The Glee Generator Template runs only once. How can we ensure types remain synchronized with AsyncAPI changes afterwards?

Possible Considerations:

Could Glee monitor the AsyncAPI file for changes?
Can type regeneration be triggered by the user for better control?

@github-actions github-actions bot removed the stale label Mar 7, 2024
Copy link
Contributor

github-actions bot commented Jul 5, 2024

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 Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
Status: Done
Development

No branches or pull requests

4 participants