I'm trying to do an authentication scheme which works in code but when I
try to create a swagger spec for it I get errors:
Here's the minimal spec I'm trying to write
---------------------
{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Test",
"description": "Test"
},
"paths": {
"/test": {
"post": {
"description": "Test",
"produces": [
"application/json"
],
"parameters": [{
"in": "body",
"name": "data",
"required": true,
"type": "string"
},
{<---------------------------- Section that causes the error
------------------------------------------
"name": "AuthToken",
"in": "header",
"description": "Authentication Token",
"required": true,
"type": "string"
}<-----------------------------------------------------------------------------------------------------------------
],
"responses": {
"200": {
"description": "pet response"
}
}
}
}
}
}
---------------------------
Now this is valid JSON (as reported by http://jsonlint.com/) but
both http://www.jsonschemavalidator.net/ (using the Swagger API 2.0) and
the editor.swagger.io report errors.
(see below for the errors reported by the schema validator).
I know that what I am trying to do "should" be possible, one of the sample
YAML files in the editor has multiple parameters in a POST (the
"petstore_full" Schema)
(but I see that none are in the body), so I know it's possible:
------------------------------
"pets": {
"tags": [
"pet"
],
"summary": "Updates a pet in the store with form data",
"description": "",
"operationId": "updatePetWithForm",
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [{
"in": "path",
"name": "petId",
"description": "ID of pet that needs to be updated",
"required": true,
"type": "string"
}, {
"in": "formData",
"name": "name",
"description": "Updated name of the pet",
"required": true,
"type": "string"
}, {
"in": "formData",
"name": "status",
"description": "Updated status of the pet",
"required": true,
"type": "string"
}],
"responses": {
"405": {
"description": "Invalid input"
}
},
"security": [{
"petstore_auth": [
"write_pets",
"read_pets"
]
}]
}
------------------------------
So my basic question is how can I have parameters in both the header of the
request as well as the body of the request?
TIA
MikeB
Errors reported by the schema validator:
Found 35 error(s)
Message:JSON is valid against no schemas from 'oneOf'.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf
Message:Property 'in' has not been defined and the schema does not allow
additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'name' has not been defined and the schema does not allow
additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'required' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Required properties are missing from object: $ref.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/required
Message:JSON is valid against no schemas from 'oneOf'.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf
Message:Value "path" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/0/properties/in/enum
Message:JSON is valid against no schemas from 'oneOf'.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf
Message:Value "path" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/2/properties/in/enum
Message:Value "path" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/1/properties/in/enum
Message:Value "path" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/0/properties/in/enum
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/3/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/2/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/1/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/0/additionalProperties
Message:Required properties are missing from object: type.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/required
Message:JSON is valid against no schemas from 'oneOf'.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf
Message:Property 'in' has not been defined and the schema does not allow
additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'name' has not been defined and the schema does not allow
additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'description' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'required' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/additionalProperties
Message:Required properties are missing from object: $ref.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/1/required
Message:JSON is valid against no schemas from 'oneOf'.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf
Message:Value "formData" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/0/properties/in/enum
Message:JSON is valid against no schemas from 'oneOf'.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf
Message:Value "formData" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/3/properties/in/enum
Message:Value "formData" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/2/properties/in/enum
Message:Value "formData" is not defined in enum.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/0/properties/in/enum
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/3/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/2/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/1/additionalProperties
Message:Property 'schema' has not been defined and the schema does not
allow additional properties.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/oneOf/0/additionalProperties
Message:Required properties are missing from object: type.Schema path:
http://swagger.io/v2/schema.json#/definitions/paths/patternProperties/^~1/properties/get/properties/parameters/items/0/oneOf/0/oneOf/1/required
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.