generator icon indicating copy to clipboard operation
generator copied to clipboard

[📑 Docs]: Improve documentation related to `File templates` feature

Open derberg opened this issue 10 months ago • 5 comments

What Dev Docs changes are you proposing?

  • we need to make it clear that https://github.com/asyncapi/generator/blob/master/docs/file-templates.md is a feature for Nunjucks render engine only
  • we need a new document, or refactor the one about File templates and explain how to do the same in react

we have at least comparizon from the perspective of "template for templates". So we see file templates in use in https://github.com/asyncapi/template-for-generator-templates/tree/nunjucks/template/schemas in times of nunjucks and then after conversion to react https://github.com/asyncapi/template-for-generator-templates/blob/master/template/schemas/schema.js

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

derberg avatar Apr 24 '24 09:04 derberg

Bounty Issue's service comment

Text labels: bounty/2024-Q3, bounty/medium, bounty/docs First assignment to third-party contributors: 2024-06-21 00:00:00 UTC+12:00 End Of Life after: 2024-07-31 23:59:59 UTC-12:00

@asyncapi/bounty_team

The Bounty Program is not a Mentorship Program. The accepted level of Bounty Program Participants is Middle/Senior.
Third-party contributors should coherently articulate how they are going to approach the resolution process when expressing a desire to work on this Bounty Issue.

aeworxet avatar Jun 17 '24 12:06 aeworxet

@aeworxet @derberg I would like to work on this issue, Past doc PR: https://github.com/asyncapi/generator/pull/1061/files https://github.com/asyncapi/community/pull/1155/files Solution Step for the above issue:

  • Split the File template into two parts Nonjuck and React Engine.
  • Show different structure of component using React Engine.

To show List Channels of asyncapi document;

/* 
 * Here you can see example of complex operations. 
 * You can actually do whatever you want. It is important that the value returned from the function must be a string or a component.
 */
export function ListChannels({ channels, operationType = 'publish' }) {
  const namesList = Object.entries(channels)
    .map(([channelName, channel]) => {
      if (
        (operationType === 'publish' && channel.hasPublish()) || 
        (operationType === 'subscribe' && channel.hasSubscribe())
      ) {
        return  `<li><strong>${channelName}</strong></li>`;
      }
    })
    .filter(Boolean);

  return `
<h2>
  Channels that you can ${operationType} to
</h2>
<hr />
<br />
<div class="container mx-auto px-8">
  <ul class="list-disc">${namesList.join('')}</ul>
</div>
`;
}

To show info, server of asyncapi document:


const ReadmeTemplate = ({ asyncapi }) => {
  const { info, servers, } = asyncapi;

  return (
    <div>
      <h1>{info.title}</h1>
      <p>{info.description}</p>
      
      <h2>Servers</h2>
      <ul>
        {Object.entries(servers).map(([name, server]) => (
          <li key={name}>
            <strong>{name}</strong>: {server.url} ({server.protocol})
          </li>
        ))}
      </ul>


    </div>
  );
};

This would be structure to show rendering of different component in React Engine thanks

AayushSaini101 avatar Jun 18 '24 04:06 AayushSaini101

@AayushSaini101 You are already assigned to https://github.com/asyncapi/community/issues/1268 and expected to work on https://github.com/asyncapi/cli/issues/337 (@Amzani will assign you when he comes back from vacation,) so the limit or two simultaneous issues is reached.

aeworxet avatar Jun 18 '24 07:06 aeworxet

@Florence-Njeri as maintainer of docs in this repo will work on this issue

derberg avatar Jun 24 '24 09:06 derberg

Bounty Issue's Timeline

Complexity Level Assignment Date (by GitHub) Start Date (by BP Rules) End Date (by BP Rules) Draft PR Submission Final PR Merge Start Final PR Merge End
Medium 2024-06-21 2024-07-01 2024-08-11 2024-07-14 2024-07-28 2024-08-11
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.

aeworxet avatar Jun 24 '24 09:06 aeworxet

@Florence-Njeri yo, so how is it going, you need help?

derberg avatar Jul 15 '24 16:07 derberg

Review for PR https://github.com/asyncapi/generator/pull/1230 was requested on 2024-08-06, and it is still in progress.

aeworxet avatar Aug 12 '24 22:08 aeworxet

Response, critical for technical resolution of this Bounty Issue (review of the PR) was delayed for two periods of three consecutive working days https://github.com/asyncapi/generator/pull/1230#event-13774088750 https://github.com/asyncapi/generator/pull/1230#pullrequestreview-2236478397

so all remaining target dates of the Bounty Issue's Timeline are extended by three calendar weeks.

Bounty Issue's Timeline Extended

Complexity Level Assignment Date (by GitHub) Start Date (by BP Rules) End Date (by BP Rules) Draft PR Submission Final PR Merge Start Final PR Merge End
Medium 2024-06-21 2024-07-01 2024-09-01 2024-08-04 2024-08-18 2024-09-01
Please note that the dates given represent deadlines, not specific dates, so if the goal is reached sooner, it's better.
Keep in mind the responsibility for violations of the Timeline.

aeworxet avatar Aug 15 '24 02:08 aeworxet

work completed with https://github.com/asyncapi/generator/pull/1230

derberg avatar Sep 02 '24 10:09 derberg

Bounty Issue Is Completed 🎉

@Florence-Njeri, please go to the AsyncAPI page on Open Collective and submit an invoice for USD 200.00 with the expense title Bounty generator#1199, tag bounty, and full URL of this Bounty Issue in the description.

aeworxet avatar Sep 02 '24 13:09 aeworxet