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

Generated Postman is invalid against their 2.1.0 spec #149

Closed
philsturgeon opened this issue Dec 6, 2017 · 2 comments
Closed

Generated Postman is invalid against their 2.1.0 spec #149

philsturgeon opened this issue Dec 6, 2017 · 2 comments

Comments

@philsturgeon
Copy link

philsturgeon commented Dec 6, 2017

I'll fix whatever the problem ends up being, but right now I'm getting so many errors that the postman collection generated with API Flow is failing to upload.

[ {
  "level" : "warning",
  "schema" : {
    "loadingURI" : "#",
    "pointer" : "/definitions/certificate/properties/matches"
  },
  "domain" : "syntax",
  "message" : "the following keywords are unknown and will be ignored: [item]",
  "ignored" : [ "item" ]
}, {
  "level" : "error",
  "schema" : {
    "loadingURI" : "#",
    "pointer" : "/properties/item/items"
  },
  "instance" : {
    "pointer" : "/item/0"
  },
  "domain" : "validation",
  "keyword" : "oneOf",
  "message" : "instance failed to match exactly one schema (matched 0 out of 2)",
  "matched" : 0,
  "nrSchemas" : 2,
  "reports" : {
    "/properties/item/items/oneOf/0" : [ {
      "level" : "error",
      "schema" : {
        "loadingURI" : "#",
        "pointer" : "/definitions/item"
      },
      "instance" : {
        "pointer" : "/item/0"
      },
      "domain" : "validation",
      "keyword" : "required",
      "message" : "object has missing required properties ([\"request\"])",
      "required" : [ "request" ],
      "missing" : [ "request" ]
    } ],
    "/properties/item/items/oneOf/1" : [ {
      "level" : "error",
      "schema" : {
        "loadingURI" : "#",
        "pointer" : "/definitions/item-group/properties/item/items"
      },
      "instance" : {
        "pointer" : "/item/0/item/0"
      },
      "domain" : "validation",
      "keyword" : "anyOf",
      "message" : "instance failed to match at least one required schema among 2",
      "nrSchemas" : 2,
      "reports" : {
        "/definitions/item-group/properties/item/items/anyOf/0" : [ {
          "level" : "error",
          "schema" : {
            "loadingURI" : "#",
            "pointer" : "/definitions/request"
          },
          "instance" : {
            "pointer" : "/item/0/item/0/request"
          },
          "domain" : "validation",
          "keyword" : "oneOf",
          "message" : "instance failed to match exactly one schema (matched 0 out of 2)",
          "matched" : 0,
          "nrSchemas" : 2,
          "reports" : {
            "/definitions/request/oneOf/0" : [ {
              "level" : "error",
              "schema" : {
                "loadingURI" : "#",
                "pointer" : "/definitions/request/oneOf/0/properties/header"
              },
              "instance" : {
                "pointer" : "/item/0/item/0/request/header"
              },
              "domain" : "validation",
              "keyword" : "oneOf",
              "message" : "instance failed to match exactly one schema (matched 0 out of 2)",
              "matched" : 0,
              "nrSchemas" : 2,
              "reports" : {
                "/definitions/request/oneOf/0/properties/header/oneOf/0" : [ {
                  "level" : "error",
                  "schema" : {
                    "loadingURI" : "#",
                    "pointer" : "/definitions/header/properties/value"
                  },
                  "instance" : {
                    "pointer" : "/item/0/item/0/request/header/0/value"
                  },
                  "domain" : "validation",
                  "keyword" : "type",
                  "message" : "instance type (null) does not match any allowed primitive type (allowed: [\"string\"])",
                  "found" : "null",
                  "expected" : [ "string" ]
                } ],
                "/definitions/request/oneOf/0/properties/header/oneOf/1" : [ {
                  "level" : "error",
                  "schema" : {
                    "loadingURI" : "#",
                    "pointer" : "/definitions/request/oneOf/0/properties/header/oneOf/1"
                  },
                  "instance" : {
                    "pointer" : "/item/0/item/0/request/header"
                  },
                  "domain" : "validation",
                  "keyword" : "type",
                  "message" : "instance type (array) does not match any allowed primitive type (allowed: [\"string\"])",
                  "found" : "array",
                  "expected" : [ "string" ]
                } ]
              }
            } ],
            "/definitions/request/oneOf/1" : [ {
              "level" : "error",
              "schema" : {
                "loadingURI" : "#",
                "pointer" : "/definitions/request/oneOf/1"
              },
              "instance" : {
                "pointer" : "/item/0/item/0/request"
              },
              "domain" : "validation",
              "keyword" : "type",
              "message" : "instance type (object) does not match any allowed primitive type (allowed: [\"string\"])",
              "found" : "object",
              "expected" : [ "string" ]
            } ]
          }
        } ],
        "/definitions/item-group/properties/item/items/anyOf/1" : [ {
          "level" : "error",
          "schema" : {
            "loadingURI" : "#",
            "pointer" : "/definitions/item-group"
          },
          "instance" : {
            "pointer" : "/item/0/item/0"
          },
          "domain" : "validation",
          "keyword" : "required",
          "message" : "object has missing required properties ([\"item\"])",
          "required" : [ "item" ],
          "missing" : [ "item" ]
        } ]
      }
    } ]
  }
} ]

Tested against Postman Collection v2.1.0 http://schema.getpostman.com/?_ga=2.73374291.1338367236.1512580333-921490803.1512580333

@philsturgeon
Copy link
Author

Actually a fun way to test this, take the content from your https://github.com/luckymarmot/API-Flow/tree/master/testing/e2e/internal-postman2/test-case-0/output.json and run it through http://json-schema-validator.herokuapp.com/ with their schema. It has loads of errors and warnings.

I'll fix a few now, including the fact you cannot have null for headers, it's got to be a string!

@philsturgeon
Copy link
Author

#154 ensures it's following the v2.0 spec, and that's good enough for me. I'll add in v2.1 support separately.

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