@CookieValue is not parsed correctly #2798
Comments
|
Cookies arent supported directly, you could write your own |
|
I second @jaydenlin. This feature would be really appreciated. Using Springfox 2.4.0: @Component
@Order(SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER + 1000)
public class SwaggerCustomParameterBuilderPlugin implements ParameterBuilderPlugin {
@Override
public void apply(ParameterContext context) {
if (isCookieValue(context)) {
context.parameterBuilder().parameterType("cookie");
}
}
private boolean isCookieValue(ParameterContext context) {
return Arrays.stream(context.methodParameter().getParameterAnnotations())
.anyMatch(annotation -> annotation.annotationType() == CookieValue.class);
}
@Override
public boolean supports(DocumentationType documentationType) {
return pluginDoesApply(documentationType);
}
} |
|
+1 to @jaydenlin's request. It's a little frustrating to have to create so much extra config for one parameter. However, thanks to @mmsoares for the workaround config I have what I need. I had to update my Using Springfox 2.9.2: @Component
@Order(SwaggerPluginSupport.SWAGGER_PLUGIN_ORDER + 1000)
public class SwaggerCustomParameterBuilderPlugin implements ParameterBuilderPlugin {
@Override
public void apply(ParameterContext context) {
if (isCookieValue(context)) {
context.parameterBuilder().parameterType("cookie");
}
}
private boolean isCookieValue(ParameterContext context) {
List<Annotation> annotations = context.resolvedMethodParameter().getAnnotations();
return annotations.stream().anyMatch(annotation -> annotation.annotationType() == CookieValue.class);
}
@Override
public boolean supports(DocumentationType documentationType) {
return pluginDoesApply(documentationType);
}
} |
|
+1 This makes me crazy. Many thanks for workaround. Because there is no imports, the last method should be : @Override
public boolean supports(DocumentationType documentationType) {
return SwaggerPluginSupport.pluginDoesApply(documentationType);
} |
|
I'll try to fix this if possible. |
|
I've just bumped up to v3 and this issue has come back for me again (as in the solution above no longer works for me). I see |
|
after added |
I used @CookieValue but the argument is parsed as
bodyparameter instead.Could you help fix this issue ?
The text was updated successfully, but these errors were encountered: