Is it possible to set an example for output header?
Hi.
First of all. I am using specification '2.0'.
I want to set a value for a response header to be returned for AutoMocking API. I have tried different approaches and this is the last one:
responses:
200:
description: OK
headers:
own-response-header:
type: string
description: own-response-header
example: "123"
schema:
$ref: "#/definitions/ContentResponse200"
But Swagerhub interface says: "should NOT have additional properties additionalProperty: example"
How can I set value for a response header?
Regards.
Hi ifernan,
Response headers support the example keyword in OpenAPI 3.0 but not in OpenAPI 2.0. You'll need to convert you API definition to OpenAPI 3.0 to be able to specify example values for response headers.
openapi: '3.0.0' ... responses: '200': description: OK headers: own-response-header: description: own-response-header schema: type: string example: "123"