Skip to content

Incorrect querystring creation #1190

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

Closed
mbaumgartl opened this issue Apr 21, 2015 · 3 comments
Closed

Incorrect querystring creation #1190

mbaumgartl opened this issue Apr 21, 2015 · 3 comments

Comments

@mbaumgartl
Copy link

I try to document my not-so-restful API using Swagger. I therefore need to overload paths. Because this is not supported (I found some discussions to that topic), I added parameters to the paths:

swagger: "2.0"

info:
  version: "0.0.1"
  title: Awesome API

host: "localhost:8003"
basePath: /

schemes:
  - http

produces:
  - application/json

paths:
  /items/{itemId}:
    get:
      parameters:
        - name: itemId
          in: path
          required: true
          type: integer
          format: int64
      responses:
        200:
          description: An item
          schema:
            type: object

  /items/{item}?action=pdf:
    get:
      parameters:
        - name: item
          in: path
          required: true
          type: integer
          format: int64
        - name: template
          in: query
          type: string
      responses:
        200:
          description: Item as PDF

If I try to run a request against second endpoint, I end up with an incorrect querystring:
http://localhost:8003/item/1?action=pdf?template=awesome

I know this is an inherited error because defining paths this way is not intended but maybe you can fix it anyway.

Maybe there is already an existing issue but I can't find it anymore (sorry).

Marco

@webron
Copy link
Contributor

webron commented Apr 21, 2015

It's simply not supported by Swagger. You cannot overload paths, and you cannot add query parameters as part of the path.

@mbaumgartl
Copy link
Author

I know ;-)

My wish seems to be a duplicate of OAI/OpenAPI-Specification#164.

Is there a real chance Swagger is going to support querystring in paths in a future version?

@webron
Copy link
Contributor

webron commented Apr 21, 2015

No idea. We haven't started making official discussions about it. But for now, it's definitely not supported.

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