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

Proof of concept of templates as part of generator monorepo #1269

Open
derberg opened this issue Sep 16, 2024 · 12 comments
Open

Proof of concept of templates as part of generator monorepo #1269

derberg opened this issue Sep 16, 2024 · 12 comments
Assignees
Labels
bounty AsyncAPI Bounty program related label enhancement New feature or request

Comments

@derberg
Copy link
Member

derberg commented Sep 16, 2024

We know we want to have some core templates developed under this repo, as a result of:

This PoC needs to answer questions like:

  • do we need to release such internal templates separately, as npm modules
  • how generator release relates to template release
  • how it will be used in the AsyncAPI CLI
  • do we keep name templates? or leave it only for extensibility part?
  • maybe https://github.com/asyncapi/nodejs-template could be moved as an example - not 100% sure as it may make things complex for review
  • how shared helpers will be maintained and tested
  • how shared components will be maintained and tested
  • should helpers and components be released as independent package? so template developers that write templates outside, can still use these. For example instead of telling people https://www.asyncapi.com/docs/tools/generator/model-generation we could have a build in components for types generation, so people do not really have to even know what modelina is and add it to dependencies
  • how testing is split

Resulting PR not necessarily needs to be merged, but should be in state that helps to followup with exact implementation

@derberg derberg added the enhancement New feature or request label Sep 16, 2024
@derberg
Copy link
Member Author

derberg commented Sep 16, 2024

As maintainer of generator I wanna work on this issue

@Gmin2
Copy link
Collaborator

Gmin2 commented Sep 16, 2024

Looking forward to see a working solution of it

@lmgyuan
Copy link
Collaborator

lmgyuan commented Sep 16, 2024

I have been thinking about this in the past couple weeks. I will come up with a tentative plan sometime today.

@asyncapi-bot asyncapi-bot added the bounty AsyncAPI Bounty program related label label Sep 16, 2024
@aeworxet
Copy link

Bounty Issue's service comment

Text labels: bounty/2024-Q4, bounty/advanced, bounty/coding
First assignment to regular contributors: 2024-09-20 00:00:00 UTC+12:00
End Of Life after: 2024-10-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.
Regular contributors should explain in meaningful words how they are going to approach the resolution process when expressing a desire to work on this Bounty Issue.

@aeworxet aeworxet moved this to No Assignee in Bounty Program Sep 16, 2024
@aeworxet
Copy link

@derberg says,

As maintainer of generator I wanna work on this issue

#1269 (comment)

@aeworxet
Copy link

@derberg is an AsyncAPI Maintainer specified in https://raw.githubusercontent.com/asyncapi/community/master/MAINTAINERS.yaml, so they fall under the first category in the prioritization list.

@aeworxet
Copy link

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
Advanced 2024-09-18 2024-10-07 2024-12-01 2024-10-27 2024-11-17 2024-12-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 aeworxet moved this from No Assignee to In Progress in Bounty Program Sep 18, 2024
@derberg derberg moved this to In Progress in Maintainers work Sep 18, 2024
@derberg
Copy link
Member Author

derberg commented Oct 9, 2024

fyi, I'm a bit delayed here, lost laptop and conference travel, now a bit overwhelmed by PRs from Hacktoberfest - but all good, still on track

@derberg
Copy link
Member Author

derberg commented Oct 29, 2024

ok, I started working on the PoC

first focus is on reusable components package, and first citizen componen we need, for models generatio, so instead of asking people to do

/ 1
import { File } from '@asyncapi/generator-react-sdk';
// 2
import { PythonGenerator, FormatHelpers } from '@asyncapi/modelina';

/**
 * @typedef RenderArgument
 * @type {object}
 * @property {AsyncAPIDocument} asyncapi document object received from the generator.
 */

/**
 * Render all schema models
 * @param {RenderArgument} param0 
 * @returns 
 */
// 3
export default async function schemaRender({ asyncapi }) {
  // 4 
  const pythonGenerator = new PythonGenerator();
  // 5
  const models = await pythonGenerator.generate(asyncapi);
  // 6
  const files = [];
  // 7
  for (const model of models) {
    // 8
    const modelFileName = `${FormatHelpers.toPascalCase(model.modelName)}.py`;
    // 9
    files.push(<File name={modelFileName}>{model.result}</File>);
  }
  return files;
}

we just tell them to install @asyncapi/generator-components and then import { Models } from '@asyncapi/generator-components' and do something like <Models asyncapi=asyncapi language=python>

@aeworxet
Copy link

@derberg (githubID 6995927,) please provide an update to the PR.

@derberg
Copy link
Member Author

derberg commented Nov 27, 2024

I need more time on this one, there is much more code that needs to be written to see the concept in action. I don't wanna rush, and also do not want to cut the scope just to get the bounty. More important is to have something working and be able to explain what we are aiming for. I hope december is enough

@aeworxet
Copy link

Upon request of the AsyncAPI Maintainer, who is responsible for the resolution of the Bounty Issue from the AsyncAPI's side and is also the Bounty Program Participant (@derberg (githubID 6995927), all remaining target dates of the Bounty Issue's Timeline are extended by four 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
Advanced 2024-09-18 2024-10-07 2024-12-29 2024-10-27 2024-12-15 2024-12-29
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty AsyncAPI Bounty program related label enhancement New feature or request
Projects
Status: In Progress
Status: In Progress
Development

No branches or pull requests

5 participants