Validating and documenting a 204 No Content endpoint
See original GitHub issueContext
- hapi-swgger version: 7.6.0
- any other relevant information:
What are you trying to achieve or the steps to reproduce ?
I’m trying to document my delete endpoint. It returns a statusCode of 204 No Content. I’m not sure how to document this endpoint and the response. If I leave the statusCode out in the validation, it won’t show up in /documentation
. If I put 204: Joi.string().length(0)
it fails validation.
What is the proper way to validate and document and endpoint which returns 204 No Content?
// handler
function (req, reply) {
// ...
return reply().code(204);
}
// Response validation
// ...
response: {
status: {
204: ?
404: schema.responseNotFound
}
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:6
Top Results From Across the Web
Validating and documenting a 204 No Content endpoint #392
What are you trying to achieve or the steps to reproduce ? I'm trying to document my delete endpoint. It returns a statusCode...
Read more >HTTP Status 204 (No Content) - REST
HTTP Status 204 (No Content) indicates that the server has successfully fulfilled the request and that there is no content to send in...
Read more >204 No Content - HTTP - MDN Web Docs - Mozilla
The HTTP 204 No Content success status response code indicates that a request has succeeded, but that the client doesn't need to navigate ......
Read more >GA4 event Validation only returns 204 - Stack Overflow
It seems a 204 status code is to be expected from GA4, i.e. no content should be returned. From inspecting the response given...
Read more >What is HTTP Status Code 204 (No Content)? - Abstract API
The HTTP Status Code 204 means that the server successfully processed the client's request, and that the server is not returning any content...
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
Could you please review this PR #601
This will allow setting a
No Content
endpoint by just specifying:Using “204: Joi.only(null)” has started to produce invalid Swagger contracts; might have a regression somewhere.