generator
generator copied to clipboard
Proof of concept of templates as part of generator monorepo
We know we want to have some core templates developed under this repo, as a result of:
- https://github.com/asyncapi/generator/issues/1249
- https://github.com/asyncapi/generator/issues/1044
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
As maintainer of generator I wanna work on this issue
Looking forward to see a working solution of it
I have been thinking about this in the past couple weeks. I will come up with a tentative plan sometime today.
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.
@derberg says,
As maintainer of generator I wanna work on this issue
https://github.com/asyncapi/generator/issues/1269#issuecomment-2352704655
@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.
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.
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
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>
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
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.
proof of concept done: https://github.com/asyncapi/generator/tree/master/packages
this issue is completed and more work to be done next
Bounty Issue Is Completed 🎉
@derberg (githubID 6995927), please go to the AsyncAPI page on Open Collective and submit an invoice for USD 400.00 with the expense title Bounty generator#1269, tag bounty, and full URL of this Bounty Issue in the description.