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

Swagger3 Authentication is not generated correctly #9843

Open
lindgrenfredrik opened this issue Nov 11, 2019 · 4 comments
Open

Swagger3 Authentication is not generated correctly #9843

lindgrenfredrik opened this issue Nov 11, 2019 · 4 comments

Comments

@lindgrenfredrik
Copy link

#9786 ### Description

Swagger3 code generator has removed authMethod section for each Operation that was available in swagger2
There is a general AuthMethod section but for oauth2 it contains all scopes so it can't be used when generating scope checks for specific operations

Swagger-codegen version

Tested with 3.0.13 & 2.4.8 so see the difference

Swagger declaration file content or url

Swagger2 & 3 files to reproduce the problem:
https://gist.github.com/lindgrenfredrik/0eb76d8ee2cac7066bfefd914632a635

Command line used for generation

java -jar -DdebugOperations=True swagger-codegen-cli.jar generate -l jaxrs-resteasy -i pet_example_2_0.json -o tmp2

java -jar -DdebugOperations=True swagger-codegen-cli-3.0.13.jar generate -l jaxrs-resteasy -i pet_example_3_0.yaml -o tmp3

@lindgrenfredrik
Copy link
Author

lindgrenfredrik commented Nov 11, 2019

For some reason part of the text I wrote was lost:

Steps to reproduce

Run commands from Command line section

See src/gen/java/io/swagger/api/PetApi.java and search for scopes to see diff

Note this is not only a template issue, scope group per operation isn't available

Suggest a fix/enhancement

Issues seems to have occurred as part of refactoring of processOperation function in DefaultGenerator.java
It seems that authMethod being set there is not getting same value as it was in swagger2

@lindgrenfredrik
Copy link
Author

might be duplicate of this defect
#9498

@ashish211985
Copy link

has this issue been resolved .. i m trying to add OAuth2 scopes using OpenApi 3.0 but when the server stub is getting generated all the scopes are getting attached to all the operation functions. Using spring & java ? @lindgrenfredrik

@lindgrenfredrik
Copy link
Author

Haven't followed up this since we choose to move over to openapi gen instead which didn't exhibit this issue, so no clue if someone has fixed this issue in Swagger3

ionel-sirbu-crunch added a commit to ionel-sirbu-crunch/swagger-codegen-bugfix-9843 that referenced this issue Jun 6, 2024
…ndpoint as a subset of the scopes defined in the `securitySchemes`.
ionel-sirbu-crunch added a commit to ionel-sirbu-crunch/swagger-codegen-bugfix-9843 that referenced this issue Jun 27, 2024
…ndpoint as a subset of the scopes defined in the `securitySchemes`.
ionel-sirbu-crunch added a commit to ionel-sirbu-crunch/swagger-codegen-bugfix-9843 that referenced this issue Jun 27, 2024
…#9843 on top of release 3.0.57, to be used until the actual bugfix is merged into the official repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants