swagger-api / swagger-api/swagger-codegen
Swagger3 Authentication is not generated correctly
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
#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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with DefaultGenerator.java and the processOperation refactoring described in the issue, then compare the Swagger 2 and Swagger 3 inputs from the linked gist using the provided generation commands. Inspect the generated src/gen/java/io/swagger/api/PetApi.java; done means operation-level @SecurityRequirement scope values are generated consistently rather than only the complete security-definition scope list.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100