Package org.springdoc.core.service
Class AbstractRequestService
java.lang.Object
org.springdoc.core.service.AbstractRequestService
The type Abstract request builder.
- Author:
- bnasslahsen
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractRequestService(GenericParameterService parameterBuilder, RequestBodyService requestBodyService, SpringDocCustomizers springDocCustomizers, SpringDocParameterNameDiscoverer localSpringDocParameterNameDiscoverer, MethodParameterPojoExtractor methodParameterPojoExtractor) Instantiates a new Abstract request builder. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddDefaultVersion(io.swagger.v3.oas.models.media.Schema schema, String defaultVersion) Adds the default version to the values and as the default of a version parameter schema.static voidaddEnumValue(io.swagger.v3.oas.models.media.Schema schema, Object value) Adds a value to the enum of a schema, if not already present.static voidaddRequestWrapperToIgnore(Class<?>... classes) Add request wrapper to ignore.voidapplyBeanValidatorAnnotations(io.swagger.v3.oas.models.parameters.RequestBody requestBody, List<Annotation> annotations, boolean isOptional) Apply bean validator annotations.voidapplyBeanValidatorAnnotations(org.springframework.core.MethodParameter methodParameter, io.swagger.v3.oas.models.parameters.Parameter parameter, List<Annotation> annotations, boolean isParameterObject, String openapiVersion) Apply bean validator annotations.io.swagger.v3.oas.models.Operationbuild(org.springframework.web.method.HandlerMethod handlerMethod, org.springframework.web.bind.annotation.RequestMethod requestMethod, io.swagger.v3.oas.models.Operation operation, MethodAttributes methodAttributes, io.swagger.v3.oas.models.OpenAPI openAPI) Build operation.io.swagger.v3.oas.models.parameters.ParameterbuildParam(ParameterInfo parameterInfo, io.swagger.v3.oas.models.Components components, com.fasterxml.jackson.annotation.JsonView jsonView) Build param parameter.io.swagger.v3.oas.models.parameters.ParameterbuildParams(ParameterInfo parameterInfo, io.swagger.v3.oas.models.Components components, org.springframework.web.bind.annotation.RequestMethod requestMethod, MethodAttributes methodAttributes, String openApiVersion) Build params parameter.protected voidcustomiseParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, ParameterInfo parameterInfo, List<io.swagger.v3.oas.models.parameters.Parameter> operationParameters) Customise parameter parameter.static Collection<io.swagger.v3.oas.models.parameters.Parameter> getHeaders(MethodAttributes methodAttributes, Map<ParameterId, io.swagger.v3.oas.models.parameters.Parameter> map) Gets headers.Gets method parameter pojo extractor.Gets optional delegating method parameter customizers.Gets parameter builder.Gets request body builder.booleanIs default flat param object boolean.static booleanisDefaultVersionServed(MethodAttributes methodAttributes, String version, String defaultVersion) Is default version served boolean.booleanisParamToIgnore(org.springframework.core.MethodParameter parameter) Is param to ignore boolean.static booleanisRequestTypeToIgnore(Class<?> rawClass) Is request type to ignore boolean.booleanisValidParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, MethodAttributes methodAttributes) Is valid parameter boolean.static voidremoveRequestWrapperToIgnore(Class<?>... classes) Remove request wrapper to ignore.
-
Constructor Details
-
AbstractRequestService
protected AbstractRequestService(GenericParameterService parameterBuilder, RequestBodyService requestBodyService, SpringDocCustomizers springDocCustomizers, SpringDocParameterNameDiscoverer localSpringDocParameterNameDiscoverer, MethodParameterPojoExtractor methodParameterPojoExtractor) Instantiates a new Abstract request builder.- Parameters:
parameterBuilder- the parameter builderrequestBodyService- the request body builderspringDocCustomizers- the spring doc customizerslocalSpringDocParameterNameDiscoverer- the local spring doc parameter name discoverermethodParameterPojoExtractor- the method parameter pojo extractor
-
-
Method Details
-
addRequestWrapperToIgnore
Add request wrapper to ignore.- Parameters:
classes- the classes
-
removeRequestWrapperToIgnore
Remove request wrapper to ignore.- Parameters:
classes- the classes
-
isRequestTypeToIgnore
Is request type to ignore boolean.- Parameters:
rawClass- the raw class- Returns:
- the boolean
-
getHeaders
public static Collection<io.swagger.v3.oas.models.parameters.Parameter> getHeaders(MethodAttributes methodAttributes, Map<ParameterId, io.swagger.v3.oas.models.parameters.Parameter> map) Gets headers.- Parameters:
methodAttributes- the method attributesmap- the map- Returns:
- the headers
-
isDefaultVersionServed
public static boolean isDefaultVersionServed(MethodAttributes methodAttributes, String version, String defaultVersion) Is default version served boolean.- Parameters:
methodAttributes- the method attributesversion- the version of the handler methoddefaultVersion- the default version- Returns:
- true if the operation serves the default version
-
addDefaultVersion
public static void addDefaultVersion(io.swagger.v3.oas.models.media.Schema schema, String defaultVersion) Adds the default version to the values and as the default of a version parameter schema.- Parameters:
schema- the schemadefaultVersion- the default version
-
addEnumValue
Adds a value to the enum of a schema, if not already present.- Parameters:
schema- the schemavalue- the value
-
build
public io.swagger.v3.oas.models.Operation build(org.springframework.web.method.HandlerMethod handlerMethod, org.springframework.web.bind.annotation.RequestMethod requestMethod, io.swagger.v3.oas.models.Operation operation, MethodAttributes methodAttributes, io.swagger.v3.oas.models.OpenAPI openAPI) Build operation.- Parameters:
handlerMethod- the handler methodrequestMethod- the request methodoperation- the operationmethodAttributes- the method attributesopenAPI- the open api- Returns:
- the operation
- See Also:
-
customiseParameter
protected void customiseParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, ParameterInfo parameterInfo, List<io.swagger.v3.oas.models.parameters.Parameter> operationParameters) Customise parameter parameter.- Parameters:
parameter- the parameterparameterInfo- the parameter infooperationParameters- the operation parameters
-
isParamToIgnore
public boolean isParamToIgnore(org.springframework.core.MethodParameter parameter) Is param to ignore boolean.- Parameters:
parameter- the parameter- Returns:
- the boolean
-
isValidParameter
public boolean isValidParameter(io.swagger.v3.oas.models.parameters.Parameter parameter, MethodAttributes methodAttributes) Is valid parameter boolean.- Parameters:
parameter- the parametermethodAttributes- the method attributes- Returns:
- the boolean
-
buildParams
public io.swagger.v3.oas.models.parameters.Parameter buildParams(ParameterInfo parameterInfo, io.swagger.v3.oas.models.Components components, org.springframework.web.bind.annotation.RequestMethod requestMethod, MethodAttributes methodAttributes, String openApiVersion) Build params parameter.- Parameters:
parameterInfo- the parameter infocomponents- the componentsrequestMethod- the request methodmethodAttributes- the method attributesopenApiVersion- the open api version- Returns:
- the parameter
-
buildParam
public io.swagger.v3.oas.models.parameters.Parameter buildParam(ParameterInfo parameterInfo, io.swagger.v3.oas.models.Components components, com.fasterxml.jackson.annotation.JsonView jsonView) Build param parameter.- Parameters:
parameterInfo- the parameter infocomponents- the componentsjsonView- the json view- Returns:
- the parameter
-
applyBeanValidatorAnnotations
public void applyBeanValidatorAnnotations(org.springframework.core.MethodParameter methodParameter, io.swagger.v3.oas.models.parameters.Parameter parameter, List<Annotation> annotations, boolean isParameterObject, String openapiVersion) Apply bean validator annotations.- Parameters:
methodParameter- the method parameterparameter- the parameterannotations- the annotationsisParameterObject- the is parameter objectopenapiVersion- the openapi version
-
applyBeanValidatorAnnotations
public void applyBeanValidatorAnnotations(io.swagger.v3.oas.models.parameters.RequestBody requestBody, List<Annotation> annotations, boolean isOptional) Apply bean validator annotations.- Parameters:
requestBody- the request bodyannotations- the annotationsisOptional- the is optional
-
getRequestBodyBuilder
Gets request body builder.- Returns:
- the request body builder
-
isDefaultFlatParamObject
public boolean isDefaultFlatParamObject()Is default flat param object boolean.- Returns:
- the boolean
-
getParameterBuilder
Gets parameter builder.- Returns:
- the parameter builder
-
getOptionalDelegatingMethodParameterCustomizers
public Optional<List<DelegatingMethodParameterCustomizer>> getOptionalDelegatingMethodParameterCustomizers()Gets optional delegating method parameter customizers.- Returns:
- the optional delegating method parameter customizers
-
getMethodParameterPojoExtractor
Gets method parameter pojo extractor.- Returns:
- the method parameter pojo extractor
-