Package org.springdoc.core
Class GenericResponseService
- java.lang.Object
-
- org.springdoc.core.GenericResponseService
-
public class GenericResponseService extends Object
The type Generic response builder.- Author:
- bnasslahsen
-
-
Constructor Summary
Constructors Constructor Description GenericResponseService(OperationService operationService, List<ReturnTypeParser> returnTypeParsers, SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils)Instantiates a new Generic response builder.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description io.swagger.v3.oas.models.responses.ApiResponsesbuild(io.swagger.v3.oas.models.Components components, org.springframework.web.method.HandlerMethod handlerMethod, io.swagger.v3.oas.models.Operation operation, MethodAttributes methodAttributes)Build api responses.io.swagger.v3.oas.models.media.ContentbuildContent(io.swagger.v3.oas.models.Components components, Annotation[] annotations, String[] methodProduces, com.fasterxml.jackson.annotation.JsonView jsonView, Type returnType)Build content content.static voidbuildContentFromDoc(io.swagger.v3.oas.models.Components components, io.swagger.v3.oas.models.responses.ApiResponses apiResponsesOp, MethodAttributes methodAttributes, io.swagger.v3.oas.annotations.responses.ApiResponse apiResponseAnnotations, io.swagger.v3.oas.models.responses.ApiResponse apiResponse)Build content from doc.voidbuildGenericResponse(io.swagger.v3.oas.models.Components components, Map<String,Object> findControllerAdvice, Locale locale)Build generic response.StringevaluateResponseStatus(Method method, Class<?> beanType, boolean isGeneric)Evaluate response status string.Set<io.swagger.v3.oas.annotations.responses.ApiResponse>getApiResponses(Method method)Gets api responses.static voidsetDescription(String httpCode, io.swagger.v3.oas.models.responses.ApiResponse apiResponse)Sets description.
-
-
-
Constructor Detail
-
GenericResponseService
public GenericResponseService(OperationService operationService, List<ReturnTypeParser> returnTypeParsers, SpringDocConfigProperties springDocConfigProperties, PropertyResolverUtils propertyResolverUtils)
Instantiates a new Generic response builder.- Parameters:
operationService- the operation builderreturnTypeParsers- the return type parsersspringDocConfigProperties- the spring doc config propertiespropertyResolverUtils- the property resolver utils
-
-
Method Detail
-
build
public io.swagger.v3.oas.models.responses.ApiResponses build(io.swagger.v3.oas.models.Components components, org.springframework.web.method.HandlerMethod handlerMethod, io.swagger.v3.oas.models.Operation operation, MethodAttributes methodAttributes)Build api responses.- Parameters:
components- the componentshandlerMethod- the handler methodoperation- the operationmethodAttributes- the method attributes- Returns:
- the api responses
-
buildGenericResponse
public void buildGenericResponse(io.swagger.v3.oas.models.Components components, Map<String,Object> findControllerAdvice, Locale locale)Build generic response.- Parameters:
components- the componentsfindControllerAdvice- the find controller advicelocale- the locale
-
buildContentFromDoc
public static void buildContentFromDoc(io.swagger.v3.oas.models.Components components, io.swagger.v3.oas.models.responses.ApiResponses apiResponsesOp, MethodAttributes methodAttributes, io.swagger.v3.oas.annotations.responses.ApiResponse apiResponseAnnotations, io.swagger.v3.oas.models.responses.ApiResponse apiResponse)Build content from doc.- Parameters:
components- the componentsapiResponsesOp- the api responses opmethodAttributes- the method attributesapiResponseAnnotations- the api response annotationsapiResponse- the api response
-
getApiResponses
public Set<io.swagger.v3.oas.annotations.responses.ApiResponse> getApiResponses(Method method)
Gets api responses.- Parameters:
method- the method- Returns:
- the api responses
-
buildContent
public io.swagger.v3.oas.models.media.Content buildContent(io.swagger.v3.oas.models.Components components, Annotation[] annotations, String[] methodProduces, com.fasterxml.jackson.annotation.JsonView jsonView, Type returnType)Build content content.- Parameters:
components- the componentsannotations- the annotationsmethodProduces- the method producesjsonView- the json viewreturnType- the return type- Returns:
- the content
-
setDescription
public static void setDescription(String httpCode, io.swagger.v3.oas.models.responses.ApiResponse apiResponse)
Sets description.- Parameters:
httpCode- the http codeapiResponse- the api response
-
-