APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.08k stars 153 forks source link

Header Parameters not validated #251

Open melloware opened 8 months ago

melloware commented 8 months ago

Reported here: https://github.com/anymaniax/orval/issues/878

If you define Header parameters using "in" : "header", it fails with

⚠️  SyntaxError: Swagger schema validation failed.
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/0 must have required property 'schema'
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/0 must NOT be valid
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/0 must match exactly one schema in oneOf
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/0 must have required property '$ref'
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/0 must match exactly one schema in oneOf
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/1 must have required property 'schema'
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/1 must NOT be valid
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/1 must match exactly one schema in oneOf
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/1 must have required property '$ref'
  #/paths/~1domino~1dataset~1file~1content~1{snapshotId}/get/parameters/1 must match exactly one schema in oneOf
 "/domino/dataset/file/content/{snapshotId}" : {
      "get" : {
        "tags" : [ "Domino" ],
        "summary" : "Get a single file content",
        "description" : "Gets the contents of a single file as a string.",
        "parameters" : [ {
          "name" : "X-Domino-Api-Key",
          "in" : "header",
          "description" : "Domino API Key",
          "required" : true,
          "example" : "83b8568486a99e4a61a49583fd8bea78cbe51ccfbabed01fa04bedf9c875ff96",
          "content" : {
            "text/plain" : { }
          }
        }, {
          "name" : "X-Domino-Api-Url",
          "in" : "header",
          "description" : "Domino URL",
          "required" : true,
          "example" : "https://domino.ksmpartners.com/v4",
          "content" : {
            "text/plain" : { }
          }
        }, {
          "name" : "snapshotId",
          "in" : "path",
          "description" : "Snapshot Identifier",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "filePath",
          "in" : "query",
          "description" : "File Path",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "File Content",
            "content" : {
              "application/json" : {
                "schema" : {
                  "type" : "string"
                }
              }
            }
          },
          "403" : {
            "description" : "Forbidden",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiError"
                }
              }
            }
          },
          "500" : {
            "description" : "Unexpected error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiError"
                }
              }
            }
          }
        }
      }
    }