generator icon indicating copy to clipboard operation
generator copied to clipboard

Enhance API docs with information about results of code generation with generateFromString using entrypoint

Open derberg opened this issue 3 years ago • 26 comments

Reason/Context

The problem is described here https://github.com/asyncapi/playground/pull/79. It must be clear that returned data is not content but an object with content and metadata + what is this metadata, and that it is only with React renderer.

Description

Probably JSDoc must be only updated. Of course, some additional section in the readme would be also welcomed 😄

derberg avatar Feb 10 '21 19:02 derberg

Quick note it might actually not be a feature but a bug. Think the generateFromString should always return the content as is regardless of whether it is a Nunjucks or React template.

If it is the case remember to change the playground afterwards.

jonaslagoni avatar Feb 10 '21 19:02 jonaslagoni

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Apr 12 '21 00:04 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Jun 12 '21 00:06 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity :sleeping: It will be closed in 60 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation. Thank you for your contributions :heart:

github-actions[bot] avatar Aug 14 '21 00:08 github-actions[bot]

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

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 :heart:

github-actions[bot] avatar Dec 15 '21 00:12 github-actions[bot]

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

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 :heart:

github-actions[bot] avatar Apr 15 '22 00:04 github-actions[bot]

it is still valid, not JSDoc fix but bug fix but still easy to do. No need to followup with playground as it is not used anymore

derberg avatar Apr 20 '22 13:04 derberg

Hi, I would like to take on this issue. A little guidance might be needed, I saw the playground PR and got some context.

starlightknown avatar Apr 27 '22 13:04 starlightknown

I think it would be enough to just extend JSDoc of this function and explain that if entrypoint option is passed then the following object is returned => https://github.com/asyncapi/generator-react-sdk/blob/master/src/renderer/template.ts#L80

@magicmatatjahu @jonaslagoni thoughts?

@starlightknown did you edit JSDoc before? do you need support in explaining how to make changes locally and test if they work as expected?

derberg avatar May 09 '22 12:05 derberg

No, I haven't done it before and yes I'll need some help please

starlightknown avatar May 09 '22 12:05 starlightknown

@starlightknown happy to help, no worries. Let's just make sure folks @magicmatatjahu @jonaslagoni agree with the fix that needs to be applied

derberg avatar May 10 '22 13:05 derberg

Sounds good to me 👍

jonaslagoni avatar May 16 '22 11:05 jonaslagoni

@starlightknown looks like this one is ready to go, still interested?

derberg avatar Jul 25 '22 12:07 derberg

Hello @derberg please I want to tweet about this issue so first-time contributors can check it out.

lumenCodes avatar Sep 19 '22 10:09 lumenCodes

@lumenCodes feel free 👍🏼

derberg avatar Sep 26 '22 12:09 derberg

Done

lumenCodes avatar Sep 27 '22 03:09 lumenCodes

Hey,

Is this still issue open to work?

There are discussions. But no PRs.

Jagrutiti avatar Nov 13 '22 08:11 Jagrutiti

In the description it is written:

Probably JSDoc must be only updated

Could you share the link of JSDoc?

Jagrutiti avatar Nov 13 '22 10:11 Jagrutiti

@Jagrutiti hey, this is still valid. JSDoc is part of the code, and then API.md file is generated from it.

This is a return definition that needs to be more specific -> https://github.com/asyncapi/generator/blob/master/lib/generator.js#L256. and https://github.com/asyncapi/generator/blob/master/lib/generator.js#L164

so basically in case entrypoint is used and output flag is set to string then generator instead of generating folders and files on a drive, it returns object like -> https://github.com/asyncapi/generator-react-sdk/blob/master/src/renderer/template.ts#L80 so generation result must be extracted from content property.

I personally do not know how to best do it with JSDoc, you need to have a look at their docs. It might be something like @return {Promise<TemplateRenderResult|undefined>} with some additional explanation. But TemplateRenderResult type would have to be there too:

    /**
     * @typedef TemplateRenderMetadata
     * @type {object}
     * @property {string} fileName
     * @property {string} permissions
     */

    /**
     * @typedef TemplateRenderResult
     * @type {object}
     * @property {string} content
     * @property {TemplateRenderMetadata} metadata
     */

@jonaslagoni any better suggestions?

derberg avatar Nov 15 '22 16:11 derberg

Not really unless we want to convert the entire project into typescript 😄 So sounds good 👍

jonaslagoni avatar Nov 15 '22 19:11 jonaslagoni

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

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 :heart:

github-actions[bot] avatar Mar 16 '23 00:03 github-actions[bot]

Hey @derberg Could you once review the PR?

chinma-yyy avatar May 25 '23 18:05 chinma-yyy

unless we want to convert the entire project into typescript

burn 😛

Could you once review the PR?

on it, sorry for delay 🙏🏼

derberg avatar Jun 21 '23 11:06 derberg

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

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 :heart:

github-actions[bot] avatar Oct 20 '23 00:10 github-actions[bot]

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

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 :heart:

github-actions[bot] avatar Mar 28 '24 00:03 github-actions[bot]

Can I take on this issue?

lmgyuan avatar Mar 28 '24 19:03 lmgyuan