generator
generator copied to clipboard
Typescript (Angular) generator
Reason/Context
- Consuming AsyncAPI from the browser via websocket (stomp) is a common scenario. DEV experience would greatly increase if you'd provide a generator for client-stubs and models similar to the openapi generator: https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/typescript-angular.md
Description
Implementation could follow the openapi generator for typescript-angular.
It would be extra cool if both would be "compatible" in the following sense: For many projects OpenAPI and AsyncAPI exist in parallel and reference the same models. There should be a maningful setup, so that e.g. models from the openapi generator could be used in the AsyncAPI generated client.
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.
@daniel-sc
For many projects OpenAPI and AsyncAPI exist in parallel and reference the same models
In AsyncAPI you can reference schemas provided using OpenAPI schema
Implementation could follow the openapi generator for typescript-angular.
So we already have https://github.com/asyncapi/modelina that generates models to TS. Just a matter of contributing missing features there. You can already use modelina in our CLI with asyncapi generate models
if you'd provide a generator for client-stubs
We can definitely help with writing a template for client generation, but writing it from scratch on our own.. will be hard to find time now. There is one guy from Oracle that I mentored on starting with client generation for WebSocket (no subprotocols afaik) but I'm not sure how he is doing (I think he just started https://github.com/tianshu-orcl/websocket-streaming-template), will check with him. Also please remember that we still did not figure out STOMP bindings and also how to reuse them in WebSocket when used as a sub protocol -> https://github.com/asyncapi/spec/issues/787
I see 👍🏼 so I assume you are happy with answer
I'm closing this one
in case you want to write code generator template lemme know if you need help