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

Trouble using 'y' as a path parameter #1685

Closed
tschaub opened this issue Sep 6, 2018 · 5 comments
Closed

Trouble using 'y' as a path parameter #1685

tschaub opened this issue Sep 6, 2018 · 5 comments
Labels
dependency Due to an issue in an external imported package question

Comments

@tschaub
Copy link
Contributor

tschaub commented Sep 6, 2018

Problem statement

Using a path parameter named y causes spec validation to fail.

Swagger specification

swagger: '2.0'

info:
  version: 1.0.0
  title: Go Swagger Test

paths:

  /letters/{y}:
    parameters:
      - name: y
        type: integer
        format: uint64
        description: Column id.
        in: path
        required: true
    get:
      summary: Get letter.
      description: Get a letter.
      produces:
        - text/plain
      responses:
        200:
          description: A letter.
          schema:
            type: string

Steps to reproduce

Save the above spec as spec/test.yml and run the following:

docker run --rm --volume "$(pwd)":/data quay.io/goswagger/swagger:0.16.0 validate /data/spec/test.yml

The result is json: cannot unmarshal bool into Go struct field SwaggerProps.paths of type string. This is unexpected.

If you change the parameter name from y to z (or lots of other letters, I didn't try them all), validation succeeds (as expected).

Environment

swagger version: 0.16.0
go version: 1.11
OS: macOS 10.13

@tschaub
Copy link
Contributor Author

tschaub commented Sep 6, 2018

I just noticed that if I quote the letter y, things work again. Curious why this is required with y and not other letters.

@fredbi
Copy link
Contributor

fredbi commented Sep 6, 2018

this is due to yaml: 'y' unmarshals as boolean true

@fredbi fredbi added question dependency Due to an issue in an external imported package labels Sep 6, 2018
@gregmarr
Copy link
Contributor

gregmarr commented Sep 6, 2018

Full list here, case does not matter: #1209 (comment)

@casualjim
Copy link
Member

@tschaub
Copy link
Contributor Author

tschaub commented Sep 6, 2018

Thanks for the responses. I'll file away this bit of new yaml knowledge.

@tschaub tschaub closed this as completed Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependency Due to an issue in an external imported package question
Projects
None yet
Development

No branches or pull requests

4 participants