swagger-codegen-generators icon indicating copy to clipboard operation
swagger-codegen-generators copied to clipboard

JavaJAXRSSpecServerCodegen never add security scopes to @Operation annotations

Open RaphC opened this issue 4 years ago • 1 comments

Hi,

the generator JavaJAXRSSpecServerCodegen uses a template apiInterface.mustache when interfaceOnly is set to true. Unluckily, if I set oauth2 security scheme and security tag I obtain a beautiful Java interface annotated with @Operation but no scope refered because processed as a list whereas it is a Map.

@Operation(summary = "blabla.....", description = "", security = { @SecurityRequirement(name = "my_auth", scopes = { "", }) }, tags={ "atag" })

I can fix this by override apiInterface.mustache and replace

scopes = { {{#scopes}}"{{scope}}"{{#hasMore}}, {{/hasMore}}{{/scopes}} ....

by

scopes = { {{#each scopes}}"{{@key}}"{{^@last}},{{/@last}}{{/each}}

How can I provide A Pull Request ?

RaphC avatar Oct 13 '20 16:10 RaphC

Hi,

Is there any progress on this?

Thank you!

cazacugmihai avatar Aug 04 '21 13:08 cazacugmihai