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

JSON in queries defined to be JSON object produces "must be object" error #848

Open
danwdart opened this issue May 23, 2023 · 1 comment

Comments

@danwdart
Copy link

Describe the bug
Using content.application/json to describe a JSON object within a query string just gives "must be object" error, even with swagger ui

To Reproduce
Have the following or similar inside the parameters section of a get schema:

        - name: a
          required: true
          in: query
          content:
            application/json:
              schema:
                type: object
                properties:
                  b:
                    type: string
                  c:
                    type: string
                  d:
                    type: string
                required: ["b", "c", "d"]

Run and try to hit the endpoint with ?a={"b":"b","c":"c","d":"d"} or open the inbuilt swagger ui server, even this gives examples which makes its own server fail in the same way.

Actual behavior
validator barfs with "a must be object"

Expected behavior
validation successful passing in the correct object to the request

@danwdart
Copy link
Author

Workaround: pass as string and validate with some other library once you get into the request, but this is suboptimal as this library was supposed to do that part.

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

1 participant