-
-
Notifications
You must be signed in to change notification settings - Fork 528
@RequestAttribute parameter appears in the UI #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I tested in 1.2.33, the parameters of RequestAttribute annotation were not ignored . Looking at the modified source code, it was found that RequestAttribute should not be added to PARAM_TYPES_TO_IGNORE, it is an annotation. Finally, I achieved my goal by customizing the RequestBuilder. @Bean
@Primary
RequestBuilder myRequestBuilder(GenericParameterBuilder parameterBuilder, RequestBodyBuilder requestBodyBuilder, OperationBuilder operationBuilder, Optional<List<OperationCustomizer>> customizers, Optional<List<ParameterCustomizer>> parameterCustomizers) {
return new RequestBuilder(parameterBuilder, requestBodyBuilder, operationBuilder, customizers, parameterCustomizers) {
@Override
protected boolean isParamToIgnore(Parameter parameter) {
if (parameter.isAnnotationPresent(RequestAttribute.class)) {
return true;
}
return super.isParamToIgnore(parameter);
}
};
} |
This issue wasn't solved, can we re-open the issue, I can work on adding a "annotation based" ignore mechanism. |
I have seen your comment on the commit. Its now fixed. |
Perfect, really fast. |
Context
I have a filter that adds attributes to the HTTP requests that are derived from headers and other things. In my controllers, I have endpoints that uses these attributes, like this:
The generated UI is:
Problem
I expect the
@RequestAttribute
to be ignored by OpenAPI, since it is an internal attribute that the client ignores. But it is still present in the interface (which is misleading) and marked as required (so the user cannot use try it out).Questions
versions
org.springframework.boot
=> 2.2.1.RELEASEorg.springdoc:springdoc-openapi-ui
=> 1.2.17The text was updated successfully, but these errors were encountered: