Hide responses node
See original GitHub issueUsually the developer knows that an endpoint can at least produce HTTP 200 OK, 400 Bad Request and 5xx Server Error.
Therefore I’d like to hide the responses node (or at least any responses beside 200 OK).
But none of the following approaches work:
@GetMapping(value = "/persons")
@Operation(summary = "GET Persons",
responses = {})
public PersonRsp persons(final Person person) {
return null;
}
@GetMapping(value = "/persons2")
@Operation(summary = "GET Persons",
responses = @ApiResponse(responseCode = "200"))
public PersonRsp persons2(final Person person) {
return null;
}
Both endpoints will show:
"responses":{
"502":{
"description":"default response",
"content":{
"*/*":{
"schema":{
"type":"object"
}
}
}
},
"400":{
"description":"default response",
"content":{
"*/*":{
"schema":{
"type":"object"
}
}
}
},
"200":{
"description":"default response",
"content":{
"*/*":{
"schema":{
"$ref":"#/components/schemas/PersonRsp"
}
},
"application/json":{
"schema":{
"$ref":"#/components/schemas/PersonRsp"
}
}
}
}
}
springdoc-1.1.33 and spring-boot-2.1.7
Issue Analytics
- State:
- Created 4 years ago
- Comments:6
Top Results From Across the Web
node.js - Is there any way I can hide the get request response ...
Short answer, no. Longer answer, depends. You can try to obscure the request with headers or query params, but still clients can always ......
Read more >Hide properties of Mongoose objects in Node.JS JSON ...
The solution is to define a custom . toJSON() method on the Mongoose schema and delete the properties which you don't want to...
Read more >How to Hide API Keys with Node JS - YouTube
Learn how to Hide API Keys with Node JS. Hiding API Keys with dotenv environment variables is possible in server-side Node JS.
Read more >Hide properties of Mongoose objects in Node.JS JSON ...
The solution is to define a custom . toJSON() method on the Mongoose schema and delete the properties which you don't want to...
Read more >[Node] How can I hide some of the headers from full response ...
Hi, I want to hide the some of the headers from full response that is shown in the transaction trace. Is that possible?...
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 FreeTop 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
Top GitHub Comments
As per OpenAPI 3 specification, your API description needs to specify the responses for all API operations. Each operation must have at least one response defined, usually a successful response. A response is defined by its HTTP status code and the data returned in the response body and/or headers:
If you need to hide HTTP Codes from other configurations (@ControllerAdvice), you can use @Hidden annotation on the methods of your ControllerAdvice.
Ok thanks for clarifying this. Let’s leave this issue closed, as my main question “how to hide responses” is solved then.
But I had to create a follow up issue regarding
@Hidden
on@ControllerAdvise
: https://github.com/springdoc/springdoc-openapi/issues/81