swagger-api / swagger-api/swagger-codegen

[PYTHON] code generation puts wrong 'in' property in auth_settings

Open
#12,064 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

the openai definition has an apiKey defined in 'cookie' but the generated code defines the apiKey in 'query'

Swagger-codegen version

swagger-codegen 3.0.40

Swagger declaration file content or url
openapi: 3.0.3

security:
  - jSessionIdCookie: []

components:
  securitySchemes:
    jSessionIdCookie:
      type: apiKey
      in: cookie
      name: JSESSIONID
Command line used for generation

java -jar C:\temp\swagger-codegen-3.0.40\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar generate -i .\my.openapi.yaml -l python -o C:\temp\client_py\

Resulting code in C:\temp\client_py\swagger_client\configuration.py

Expected:
'in': 'cookie'

Actual:
'in': 'query'

def auth_settings(self):
        """Gets Auth Settings dict for api client.

        :return: The Auth Settings information dict.
        """
        return {
            'jSessionIdCookie':
                {
                    'type': 'api_key',
                    'in': 'query',
                    'key': 'JSESSIONID',
                    'value': self.get_api_key_with_prefix('JSESSIONID')
                },
        }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied OpenAPI 3.0.3 declaration and the Python generator command. Inspect the generated swagger_client/configuration.py auth_settings output; done means the jSessionIdCookie entry preserves the declared cookie location and uses 'in': 'cookie' instead of 'query'.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
authentication, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.