I am using swagger with jersey.
Is there a way to hide parameters that we don't want shown on the api being generated. That is, is there a way to prevent certain @QueryParam or @HeaderParam from being added to the list of parameters being generated.
Internally we use the access value in the annotation to hide them--we set access="internal" and let a filter look at the permissions of the user making the call (per api_key and auth_token) to make sure they're visible. I'll look at the filter logic to see if we can expose it in the core project.
thanks for the quick response. I have another question relating to hiding a parameter.
I have the following code:
(@ApiParam(access = "internal" , required = false)@InjectParam final DefectSearchBeanV1 searchBean
It works without the @ApiParam annotation but when I include it, my rest service breaks and the endpoint gives HTTP Status 415 - Unsupported Media Type.
can you help make a test case? The @ApiParam shouldn't affect this at all.
Sorry. What do you mean by writing a test case. Are you looking for a junit? Is there a sample that I can follow?
2nd that. This enhancement will be very useful
This is in the 1.3-develop branch, see this test case:
Should be very easy to support this now.
pushed as 1.3.0-SNAPSHOT
I can't get this working. I have a header param annotated with
@ApiParam(access="internal", required=false) @HeaderParam(HeadersNames.API_ID) @Pattern(regexp = RegularExpressions.REGEXP_OBJECT_ID) String appId
The param is always present in the generated JSON.
{
"name":"Object-Id",
"required":false,
"allowMultiple":false,
"type":"string",
"paramType":"header",
"paramAccess":"internal"
}
And it is shown in swagger-ui
It's swagger-ui failing? Did I miss something?
Thanks in advance
@ApiIgnore
@RequestParam(value= DEBUG_MODE,...)
Working for me.
Most helpful comment
@ApiIgnore @RequestParam(value= DEBUG_MODE,...)Working for me.