Reputation: 697
Is it possible to not include responses object with open api 3.0.1?
openapi: 3.0.1
info:
version: '1.0'
title: Hello World API
paths:
/hello-health:
head:
description: Head hello world
security: []
operationId: helloworld-read
I am getting error Errors Hide
Structural error at paths./hello-health.head should have required property 'responses' missingProperty: responses
I tried different variation, including empty property responses, empty object and it always fails the validation.
Example can be preview on https://editor.swagger.io/
Upvotes: 2
Views: 2759
Reputation: 98021
The responses
element is optional starting from OpenAPI 3.1 (openapi: 3.1.0
).
In OpenAPI 2.0 and 3.0, the responses
element is required and must contain at least one response definition. You can use the default
response instead of specific HTTP status codes.
paths:
/hello-health:
head:
responses:
default: # <-----
description: Description of the default response
Upvotes: 3