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.77k stars 6.57k forks source link

[BUG] [Spring] Authorization lock greyed out in generated code #9617

Open upsh opened 3 years ago

upsh commented 3 years ago

Hello,

I downloaded the petstore.yaml from https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml and used openapi-codegen to generate spring server for this yaml. On executing the generated code, I was expecting that authorization would be sought at the relevant places, however the authorization lock was grayed out (also refer the attached screen shot). Therefore, there is no way to enter Authorization details.

The openapi-codegen version was the latest 5.1.1 jar downloaded from https://openapi-generator.tech/docs/installation/

Can you please suggest if this going to be fixed soon?

Thanks and Regards.

openApi_AuthZ_issue

wthys commented 3 years ago

I had the same issue the other day. I fixed it by defining a second Docket bean in my application code that contains the relevant SecurityScheme objects (don't forget to give this Docket a groupName other than "default"). The Springfox docs are a great help to get this set up.

Ideally, the generator would do this for you when it notices the objects in #/components/securitySchemes.