OpenAPI 3: Cannot create example from empty response
See original GitHub issueI want to create examples with an empty response body. However, Microcks does not recognize the example at all, possibly because there is no matching response.
What’s the best way to achieve this?
Example
openapi: 3.0.1
info:
title: sample
version: '1.0'
paths:
/accounts/{accountId}:
delete:
parameters:
- name: accountId
in: path
required: true
schema:
$ref: "#/components/schemas/accountId"
examples:
"Example 1":
value: 396be545-e2d4-4497-a5b5-700e89ab99c0
responses:
204:
$ref: "#/components/responses/NO_CONTENT_204"
components:
responses:
NO_CONTENT_204:
description: No Content
schemas:
accountId:
type: string
format: uuid
accountDetails:
type: object
properties:
resourceId:
type: string
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Cannot generate OpenAPI 3.x code describing an HTTP ...
This annotation generates a compiler warning, due to the assignment of an empty generic array ( Array<Content> ) to a property with a...
Read more >Open Api 3.0 HEAD with no responses property - Stack Overflow
I tried different variation, including empty property responses, empty object and it always fails the validation. Example can be preview on ...
Read more >Describing Responses - Swagger
To learn about the latest version, visit OpenAPI 3 pages. Describing Responses. An API specification needs to specify the responses for all API...
Read more >OpenAPI Specification v3.1.0 | Introduction, Definitions, & More
An exception is if the path item is empty, for example due to ACL constraints, matching path parameters are not required. The value...
Read more >Set up method responses in API Gateway - AWS Documentation
There is no need for you to set up the API method response. ... For example, responses of 200, 400, and 500 indicate...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lbroudoux Thanks, this work-around makes the trick for now. You can close this issue.
Sorry I was too quick answering and the response is syntactically incorrect. The syntactically correct form would be:
This is just a suggestion as I do not have some time right now to test this. Will try to find some time on this week-end.
I don’t think your suggestion will work as you may have multiples responses with different response code (
200
,201
or204
) that may depend on different input params and thus being differentexamples
.