Package io.swagger.v3.jaxrs2
Class Reader
- java.lang.Object
-
- io.swagger.v3.jaxrs2.Reader
-
- All Implemented Interfaces:
OpenApiReader
public class Reader extends Object implements OpenApiReader
-
-
Field Summary
Fields Modifier and Type Field Description protected OpenAPIConfigurationconfigstatic StringDEFAULT_DESCRIPTIONstatic StringDEFAULT_MEDIA_TYPE_VALUE
-
Constructor Summary
Constructors Modifier Constructor Description Reader()Reader(OpenAPIConfiguration openApiConfiguration)Reader(OpenAPI openAPI)protectedReader(OpenAPI openAPI, Paths paths, Set<Tag> openApiTags, Components components)protectedReader(OpenAPI openAPI, Paths paths, Set<Tag> openApiTags, Components components, OpenAPIConfiguration openApiConfiguration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidapplyPathParamsPatterns(Operation operation, Map<String,String> patternsMap)protected ComponentsgetComponents()OpenAPIgetOpenAPI()protected Set<Tag>getOpenApiTags()protected StringgetOperationId(String operationId)protected ResolvedParametergetParameters(Type type, List<Annotation> annotations, Operation operation, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)protected Optional<List<Parameter>>getParametersListFromAnnotation(Parameter[] parameters, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, Operation operation, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)protected PathsgetPaths()protected Class<?>getSubResourceWithJaxRsSubresourceLocatorSpecs(Method method)protected booleanignoreOperationPath(String path, String parentPath)protected booleanignoreOperationPathStrict(String path, String parentPath)protected booleanisMethodOverridden(Method method, Class<?> cls)protected booleanisOperationHidden(Method method)protected OperationparseMethod(Class<?> cls, Method method, List<Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<SecurityRequirement> classSecurityRequirements, Optional<ExternalDocumentation> classExternalDocs, Set<String> classTags, List<Server> classServers, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, ApiResponse[] classResponses, com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)OperationparseMethod(Method method, List<Parameter> globalParameters, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)OperationparseMethod(Method method, List<Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<SecurityRequirement> classSecurityRequirements, Optional<ExternalDocumentation> classExternalDocs, Set<String> classTags, List<Server> classServers, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, ApiResponse[] classResponses)OperationparseMethod(Method method, List<Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<SecurityRequirement> classSecurityRequirements, Optional<ExternalDocumentation> classExternalDocs, Set<String> classTags, List<Server> classServers, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, ApiResponse[] classResponses, com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)protected ContentprocessContent(Content content, Schema<?> schema, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes)protected voidprocessRequestBody(Parameter requestBodyParameter, Operation operation, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<Parameter> operationParameters, Annotation[] paramAnnotations, Type type, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, Map<String,Encoding> encoding)OpenAPIread(Class<?> cls)Scans a single class for Swagger annotations - does not invoke ReaderListenersOpenAPIread(Class<?> cls, String parentPath, String parentMethod, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, Set<String> parentTags, List<Parameter> parentParameters, Set<Class<?>> scannedResources)OpenAPIread(Set<Class<?>> classes)Scans a set of classes for both ReaderListeners and OpenAPI annotations.OpenAPIread(Set<Class<?>> classes, Map<String,Object> resources)protected StringresolveApplicationPath()protected ContentresolveEmptyContent(javax.ws.rs.Produces classProduces, javax.ws.rs.Produces methodProduces)protected voidresolveResponseSchemaFromReturnType(Operation operation, ApiResponse[] responses, Schema<?> schema, javax.ws.rs.Produces classProduces, javax.ws.rs.Produces methodProduces)voidsetApplication(javax.ws.rs.core.Application application)voidsetConfiguration(OpenAPIConfiguration openApiConfiguration)protected voidsetOperationObjectFromApiOperationAnnotation(Operation operation, Operation apiOperation, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
-
-
-
Field Detail
-
DEFAULT_MEDIA_TYPE_VALUE
public static final String DEFAULT_MEDIA_TYPE_VALUE
- See Also:
- Constant Field Values
-
DEFAULT_DESCRIPTION
public static final String DEFAULT_DESCRIPTION
- See Also:
- Constant Field Values
-
config
protected OpenAPIConfiguration config
-
-
Constructor Detail
-
Reader
public Reader()
-
Reader
public Reader(OpenAPI openAPI)
-
Reader
public Reader(OpenAPIConfiguration openApiConfiguration)
-
Reader
protected Reader(OpenAPI openAPI, Paths paths, Set<Tag> openApiTags, Components components)
-
Reader
protected Reader(OpenAPI openAPI, Paths paths, Set<Tag> openApiTags, Components components, OpenAPIConfiguration openApiConfiguration)
-
-
Method Detail
-
getOpenAPI
public OpenAPI getOpenAPI()
-
getComponents
protected Components getComponents()
-
getPaths
protected Paths getPaths()
-
read
public OpenAPI read(Class<?> cls)
Scans a single class for Swagger annotations - does not invoke ReaderListeners
-
read
public OpenAPI read(Set<Class<?>> classes)
Scans a set of classes for both ReaderListeners and OpenAPI annotations. All found listeners will be instantiated before any of the classes are scanned for OpenAPI annotations - so they can be invoked accordingly.- Parameters:
classes- a set of classes to scan- Returns:
- the generated OpenAPI definition
-
setConfiguration
public void setConfiguration(OpenAPIConfiguration openApiConfiguration)
- Specified by:
setConfigurationin interfaceOpenApiReader
-
read
public OpenAPI read(Set<Class<?>> classes, Map<String,Object> resources)
- Specified by:
readin interfaceOpenApiReader
-
resolveApplicationPath
protected String resolveApplicationPath()
-
read
public OpenAPI read(Class<?> cls, String parentPath, String parentMethod, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, Set<String> parentTags, List<Parameter> parentParameters, Set<Class<?>> scannedResources)
-
applyPathParamsPatterns
protected void applyPathParamsPatterns(Operation operation, Map<String,String> patternsMap)
-
processContent
protected Content processContent(Content content, Schema<?> schema, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes)
-
processRequestBody
protected void processRequestBody(Parameter requestBodyParameter, Operation operation, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<Parameter> operationParameters, Annotation[] paramAnnotations, Type type, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, Map<String,Encoding> encoding)
-
parseMethod
public Operation parseMethod(Method method, List<Parameter> globalParameters, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
-
parseMethod
public Operation parseMethod(Method method, List<Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<SecurityRequirement> classSecurityRequirements, Optional<ExternalDocumentation> classExternalDocs, Set<String> classTags, List<Server> classServers, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, ApiResponse[] classResponses)
-
parseMethod
public Operation parseMethod(Method method, List<Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<SecurityRequirement> classSecurityRequirements, Optional<ExternalDocumentation> classExternalDocs, Set<String> classTags, List<Server> classServers, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, ApiResponse[] classResponses, com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)
-
parseMethod
protected Operation parseMethod(Class<?> cls, Method method, List<Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<SecurityRequirement> classSecurityRequirements, Optional<ExternalDocumentation> classExternalDocs, Set<String> classTags, List<Server> classServers, boolean isSubresource, RequestBody parentRequestBody, ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, ApiResponse[] classResponses, com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)
-
resolveEmptyContent
protected Content resolveEmptyContent(javax.ws.rs.Produces classProduces, javax.ws.rs.Produces methodProduces)
-
resolveResponseSchemaFromReturnType
protected void resolveResponseSchemaFromReturnType(Operation operation, ApiResponse[] responses, Schema<?> schema, javax.ws.rs.Produces classProduces, javax.ws.rs.Produces methodProduces)
-
setOperationObjectFromApiOperationAnnotation
protected void setOperationObjectFromApiOperationAnnotation(Operation operation, Operation apiOperation, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
-
getParametersListFromAnnotation
protected Optional<List<Parameter>> getParametersListFromAnnotation(Parameter[] parameters, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, Operation operation, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
-
getParameters
protected ResolvedParameter getParameters(Type type, List<Annotation> annotations, Operation operation, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
-
isOperationHidden
protected boolean isOperationHidden(Method method)
-
setApplication
public void setApplication(javax.ws.rs.core.Application application)
-
ignoreOperationPathStrict
protected boolean ignoreOperationPathStrict(String path, String parentPath)
-
-