Skip to content

Fix missing path parameters when also adding headers #216

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matgoebl
Copy link

mitmproxy2swagger adds path parameters like /{id} correctly as

      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string

When using mitmproxy2swagger --headers the headers are added, but the parameters will be missing:

      parameters:
      - name: content-type
        in: header
        required: false
        schema:
          type: string

The correct result should be

      parameters:
      - name: content-type
        in: header
        required: false
        schema:
          type: string
      - name: id
        in: path
        required: true
        schema:
          type: string

The reason for this bug is that if args.headers is used, the key parameters in swagger is already set and the later set_key_if_not_exists for params does not extend the key parameters.
One (least invasive) fix is to merge both arrays.

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

Successfully merging this pull request may close these issues.

1 participant