quarkus-openapi-generator icon indicating copy to clipboard operation
quarkus-openapi-generator copied to clipboard

Change context to RequestScoped

Open jota-coelho opened this issue 1 year ago • 4 comments

Is it possible to remove @jakarta.enterprise.context.ApplicationScoped from the generated class? Both on the client and server sides. I need the classes to be @RequestScoped instead.

jota-coelho avatar Feb 17 '25 17:02 jota-coelho

Hmm it's if we implement such a feature so one can opt-in to @RequestScoped instead:

  1. Add a new build-time, codegen property to use request scoped
  2. Read this property in the template file and add a conditional there

Application scope should be the default one. Feel free to send a PR.

ricardozanini avatar Feb 18 '25 22:02 ricardozanini

What about generating with @Dependent? Then the scope is bound to the bean injecting it?

gastaldi avatar Feb 18 '25 22:02 gastaldi

What about generating with @Dependent? Then the scope is bound to the bean injecting it?

+1

ricardozanini avatar Feb 19 '25 17:02 ricardozanini

To solve it from server side we need to change the apicurio-codegen project. I created an issue https://github.com/Apicurio/apicurio-codegen/issues/310

mcruzdev avatar Feb 25 '25 15:02 mcruzdev

The apicurio generates interfaces, the implementation can use the proper scope.

mcruzdev avatar Mar 13 '25 01:03 mcruzdev

@ricardozanini @hbelmiro This is being labeled as Stale.

github-actions[bot] avatar May 12 '25 12:05 github-actions[bot]

@ricardozanini @hbelmiro This is being closed due to inactivity.

github-actions[bot] avatar May 19 '25 12:05 github-actions[bot]