OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.86k stars 6.59k forks source link

[REQ] Move X_OPERATION_EXTRA_ANNOTATION to AbstractJavaCodegen #19518

Open coiouhkc opened 2 months ago

coiouhkc commented 2 months ago

Is your feature request related to a problem? Please describe.

x-operation-extra-annotation provides a possibility to add e.g. @RolesAllowed annotation in SpringCodegen

Describe the solution you'd like

Move the vendor extension up the hierarchy to AbstractJavaCodegen so that other java generators (jaxrs-spec, etc.) could profit from it.

It would also make it consistent with current implementation which includes both x-class-extra-annotation and x-field-extra-annotation, see https://github.com/rodrigoma3/openapi-generator/blob/e2f8436ab2bc800e6378e804118181e0550cac53/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java#L2323-L2324

Describe alternatives you've considered

None

Additional context

-

coiouhkc commented 2 months ago

Initial implementation in https://github.com/OpenAPITools/openapi-generator/pull/16259; @rodrigoma3, @borsch was there a particular reason to only include the extension into SpringCodegen ?

coiouhkc commented 2 months ago

If [REQ] is accepted, happy to work on a PR.

rodrigoma3 commented 2 months ago

Initial implementation in #16259; @rodrigoma3, @borsch was there a particular reason to only include the extension into SpringCodegen ?

No special reason, I followed the X_PATTERN_MESSAGE path and validated only SpringCodegen. But I agree with your request.