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

Respone data type validation is failing in nested json unless at json level the parameter is marked as mandatory #362

Open
joshi-mohit opened this issue May 19, 2021 · 1 comment
Labels

Comments

@joshi-mohit
Copy link

e.g
for response as
{"authentication":{"token":"xxx","bid":6,"umail":"[email protected]"}} -- should give error (since bid is specificed as string but actually in data is an integer) for below schema -- but it does not do so. (But if in the below schema if we make either "authentication" as mandatory or we make "token&bid&umail" as mandatory, this detects the error) -- is this right behavior ?

    "responses": {
      "200": {
        "description": "Login sucessful",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "authentication": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    },
                    "bid": {
                      "type": "string"
                    },
                    "umail": {
                      "type": "string",
                      "format": "email"
                    }
                  },
                }
              },
            }
          }
        }
      }
    }
@fenollp fenollp added the bug label May 31, 2021
@fenollp
Copy link
Collaborator

fenollp commented May 31, 2021

Indeed this is a bug that the (in progress) switch to gojsonschema fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants