RapiDoc icon indicating copy to clipboard operation
RapiDoc copied to clipboard

header objects being ignored

Open Allc9001 opened this issue 3 years ago • 0 comments

I'm trying to use rapi-doc using openapi spec version 3.0.1. One of my headers is an object (rather than primimative) and it looks like this header is being ignored. Below is a snippet of my spec which shows this issue. The login endpoint needs 2 headers in the request - realm and x-api-key. While the realm header is populated as expected in the curl example the other header (x-api-key) appears to be ignored. According to the spec a header can be an object:

https://spec.openapis.org/oas/v3.0.1#parameter-object

Finally, if I take my spec snippet and plug it into https://editor.swagger.io/ it works as expected.

What do you think ? Should this work or am I doing something wrong ?

Here is the snippet of my openapi spec to show the issue:

{
  "openapi" : "3.0.1",
  "info" : {
      "title": "Title",
      "version": "Version"
  },
  "paths" : {
    "/api/{ver}/login" : {
      "post" : {
        "tags" : [ "User" ],
        "summary" : "Login with secret",
        "description" : "Allow a user to login with a valid id and secret.",
        "operationId" : "login_1",
        "parameters" : [ {
          "name" : "ver",
          "in" : "path",
          "description" : "The version of the endpoint",
          "required" : true,
          "schema" : {
            "type" : "string"
          },
          "example" : "v2"
        }, {
          "name" : "Realm",
          "in" : "header",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "x-api-key",
          "in" : "header",
          "schema" : {
            "$ref" : "#/components/schemas/ApiKey"
          },
          "explode": true
        } ],
        "requestBody" : {
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/LoginRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "201" : {
            "description" : "A user was successfully authenticated."
          },
          "404" : {
            "description" : "A user failed to login."
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "ApiKey" : {
        "type" : "object",
        "properties" : {
          "key" : {
            "type" : "string"
          }
        }
      },
      "LoginRequest" : {
        "type" : "object",
        "properties" : {
          "id" : {
            "type" : "string"
          },
          "idPresent" : {
            "type" : "boolean"
          },
          "passwordPresent" : {
            "type" : "boolean"
          },
          "secret" : {
            "type" : "string"
          }
        }
      }
    }
  }
}

Allc9001 avatar Feb 21 '23 12:02 Allc9001