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

Support for multiple versions of generator #1388

Open
4 tasks
derberg opened this issue Apr 24, 2024 · 14 comments · May be fixed by #1472
Open
4 tasks

Support for multiple versions of generator #1388

derberg opened this issue Apr 24, 2024 · 14 comments · May be fixed by #1472
Assignees
Labels
area/dx enhancement New feature or request

Comments

@derberg
Copy link
Member

derberg commented Apr 24, 2024

So generator reach out v2 dropping support for some node versions: https://github.com/asyncapi/generator/releases/tag/v2.0.0

Normally according to #573 we should bump generator in cli and release new major of CLI. Basically generator drops support for node prior v18 and cli still supports older versions

but this is not a problem

problem is the generator functionality that we have, to prevent templates from failing with new generator version that may have breaking changes, we have such setting: https://github.com/asyncapi/java-template/blob/master/package.json#L102

so if we bump v2 generator in CLI, all the users of templates, will be blocked until templates developers will update config to support v2. Makes sense

so yeah:

  • do we start supporting both generators here, and have a logic that basing on the config of the template, different generator is used
  • or should we assume people use CLI properly, they use always a fixed version, and the same with templates - always specific version. So they will not notice issues, and basically upgrade only when they feel a need and other projects are ready?

Scope

  • Discover how we can support both generators (v2 and < v2)
  • Implementation
  • Add new tests
  • Communicate the change
@Amzani
Copy link
Collaborator

Amzani commented Apr 29, 2024

or should we assume people use CLI properly, they use always a fixed version, and the same with templates - always specific version. So they will not notice issues, and basically upgrade only when they feel a need and other projects are ready?

When you say they use always a fixed version you mean templates version right? this is something we could get from insights we are collecting (cc @peter-rr )

Copy link
Member Author

derberg commented Apr 29, 2024

I mean, that in theory people in production should never install CLI as npm install @asyncapi/cli but npm install @asyncapi/[email protected] for example.

Same with templates, in production, in pipelines they should run generation with templates not pointing like here, to latest: asyncapi generate fromTemplate asyncapi.yaml @asyncapi/nodejs-template but for example asyncapi generate fromTemplate asyncapi.yaml @asyncapi/[email protected].

The problem is - can we assume people do it properly, can we "expect" them do it like this - and have it as defined assumption - so they always manually decide to use new version? the problem with this assumption is that it is not the best DX 🤔 So probably philosophy here should be to always assume people not always read docs, and we should somehow proactively protect them.

From my perspective, always better to enable support for new generator version (or optimizer or anything else) and set the older one to deprecate with some period to have it enabled, and then removed 🤔 really hard to decide

@derberg
Copy link
Member Author

derberg commented Apr 30, 2024

From my perspective, always better to enable support for new generator version (or optimizer or anything else) and set the older one to deprecate with some period to have it enabled, and then removed 🤔 really hard to decide

no other option really. We can educate through docs: https://www.asyncapi.com/docs/tools/generator/versioning but this is in my opinion just to make our lives easier, not users

@peter-rr
Copy link
Member

peter-rr commented May 2, 2024

When you say they use always a fixed version you mean templates version right? this is something we could get from insights we are collecting (cc @peter-rr )

Sure! Currently we are collecting the template used, and also the CLI version if specified by the user, according to the documentation. I guess we could collect the template version as well if needed 🤔

this.metricsMetadata.template = template;

So the different use cases are:

  • asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template will produce:
asyncapi_adoption.action.finished       COUNTER {
  user: '5db8f33f-320c-4d50-85a5-7e8135c33380',
  action: 'generate:fromTemplate',
  template: '@asyncapi/html-template',
  success: true,
  asyncapi_version: '3.0.0',
  asyncapi_servers: 1,
  asyncapi_channels: 1,
  asyncapi_messages: 1,
  asyncapi_operations_send: 0,
  asyncapi_operations_receive: 1,
  asyncapi_schemas: 4
}       1
asyncapi_adoption.action.finished       COUNTER {
  user: '5db8f33f-320c-4d50-85a5-7e8135c33380',
  action: 'generate:fromTemplate',
  template: '@asyncapi/[email protected]',
  success: true,
  asyncapi_version: '3.0.0',
  asyncapi_servers: 1,
  asyncapi_channels: 1,
  asyncapi_messages: 1,
  asyncapi_operations_send: 0,
  asyncapi_operations_receive: 1,
  asyncapi_schemas: 4
}       1

@Amzani
Copy link
Collaborator

Amzani commented May 3, 2024

We can leverage also the efforts @Shurtu-gal is making to improve DX CLI, for instance if we want to force users to explicitly mention versions we can show a documentation link that shows the versions map between generator and templates.

Copy link
Member Author

derberg commented May 6, 2024

ok, so we look at a solution to support different version of generator in the CLI, right?

@Amzani
Copy link
Collaborator

Amzani commented May 7, 2024

Yes @derberg I think it's the most DX friendly option.

@Amzani Amzani added the area/dx label May 7, 2024
@derberg
Copy link
Member Author

derberg commented May 7, 2024

are you, maintainers, will work on it or you have no capacity and rather expect contribution?

@Amzani
Copy link
Collaborator

Amzani commented May 7, 2024

I think @peter-rr or @AayushSaini101 will be interested in picking it up with some support.

@Amzani
Copy link
Collaborator

Amzani commented May 13, 2024

We can submit this as a bounty issue for Q3-2024

Copy link
Member Author

derberg commented May 13, 2024

ok, but then we're talking about July. So until July nobody will be able to use new AsyncAPI Generator

@peter-rr
Copy link
Member

ok, but then we're talking about July. So until July nobody will be able to use new AsyncAPI Generator

@Amzani Should we add then this issue to the current DX Working Group's cycle?

@Amzani
Copy link
Collaborator

Amzani commented May 14, 2024

@peter-rr done

@peter-rr
Copy link
Member

peter-rr commented Jun 17, 2024

Scope update:

  • Discover how we can support both generators (v2 and < v2)

Working on the implementation now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dx enhancement New feature or request
Projects
Status: In progress
Status: 🔖 Ready
Development

Successfully merging a pull request may close this issue.

3 participants