Skip to content

header objects being ignored #894

@Allc9001

Description

@Allc9001

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"
          }
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions