generator icon indicating copy to clipboard operation
generator copied to clipboard

Introduce API generation for components

Open derberg opened this issue 5 months ago • 6 comments

now we have: https://github.com/asyncapi/generator/blob/master/apps/react-sdk/API.md#functions with basic components and nothing else

but more and more components will get into https://github.com/asyncapi/generator/tree/master/packages/components/src/components

  • we need a simple solution connected with npm run generate:assets that will generate one single API.md with list of all components
  • maybe we should move File, Indent and Text components out from react-sdk and release them as part of @asyncapi/components?

derberg avatar Aug 04 '25 09:08 derberg

Hi @derberg I’d love to take this up. I can create a script that scans packages/components/src/components and auto-generates an API.md with all components, hooked into npm run generate:assets. I can also look into moving File, Indent, and Text to @asyncapi/components if that makes sense. Please let me know if you’d like me to proceed this way.

harshhgithub avatar Aug 23 '25 08:08 harshhgithub

According to me for now we should focus on getting docs up for components. I don't think we should instantly move File, Indent and Text components out from react-sdk because it is implemented carefully in TS with nice logic of Transpile and Render process while our @asyncapi/generator-components is in JS and also more towards experimental phase still. It is fine for now if we have 2 different libraries because main goal of react-sdk is provide basic components and @asyncapi/generator-components is like a framework of react-sdk which provides 1 extra layer of abstraction.

@derberg wdyt 🤔?

Adi-204 avatar Aug 26 '25 19:08 Adi-204

also more towards experimental phase still

yup, this is an argument that plays well here.

so for now we can try with just @asyncapi/generator-components API generation as it is now, with what we have there now

derberg avatar Aug 26 '25 20:08 derberg

@harshhgithub if you are interested you can work on the issue. Please read https://github.com/asyncapi/generator/blob/master/CONTRIBUTING.md and don't create PR directly just drop a comment that you are working on it or not, easy for maintainers to track issues.

Adi-204 avatar Aug 27 '25 05:08 Adi-204

As I understand it, there should be an API.md that contains unified documentation for components from both

  • ./apps/react-sdk/src/components
  • ./packages/components/src/components

PR https://github.com/asyncapi/generator/pull/1767 attempted to utilize JSDoc comments from ./packages/components/src/components, while also addressing https://github.com/asyncapi/generator/issues/1724 for JSDocs de-duplication, but since jsdoc-to-markdown does not understand the inline ? optional syntax, I either have to rewrite JSDoc comments or migrate the project to TypeScript.

As rewriting JSDocs to a plain object map with @property {string} [returnType] to mark optional properties would be a significant step backward, and the source code of @asyncapi/generator-components is leaning toward migration to TypeScript anyway, I find this a good occasion to rewrite @asyncapi/generator-components in TypeScript, which appears to immediately resolve both https://github.com/asyncapi/generator/issues/1656 and https://github.com/asyncapi/generator/issues/1724.

Would rewriting @asyncapi/generator-components in TypeScript to simultaneously resolve both https://github.com/asyncapi/generator/issues/1656 and https://github.com/asyncapi/generator/issues/1724 be acceptable?

batchu5 avatar Dec 02 '25 11:12 batchu5

@derberg @Adi-204, what do you think?

batchu5 avatar Dec 14 '25 06:12 batchu5