Class Reader

  • All Implemented Interfaces:
    io.swagger.v3.oas.integration.api.OpenApiReader

    public class Reader
    extends Object
    implements io.swagger.v3.oas.integration.api.OpenApiReader
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        Reader()  
        Reader​(io.swagger.v3.oas.integration.api.OpenAPIConfiguration openApiConfiguration)  
        Reader​(io.swagger.v3.oas.models.OpenAPI openAPI)  
      protected Reader​(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Paths paths, Set<io.swagger.v3.oas.models.tags.Tag> openApiTags, io.swagger.v3.oas.models.Components components)  
      protected Reader​(io.swagger.v3.oas.models.OpenAPI openAPI, io.swagger.v3.oas.models.Paths paths, Set<io.swagger.v3.oas.models.tags.Tag> openApiTags, io.swagger.v3.oas.models.Components components, io.swagger.v3.oas.integration.api.OpenAPIConfiguration openApiConfiguration)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void applyPathParamsPatterns​(io.swagger.v3.oas.models.Operation operation, Map<String,​String> patternsMap)  
      protected io.swagger.v3.oas.models.Components getComponents()  
      io.swagger.v3.oas.models.OpenAPI getOpenAPI()  
      protected Set<io.swagger.v3.oas.models.tags.Tag> getOpenApiTags()  
      protected String getOperationId​(String operationId)  
      protected ResolvedParameter getParameters​(Type type, List<Annotation> annotations, io.swagger.v3.oas.models.Operation operation, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)  
      protected Optional<List<io.swagger.v3.oas.models.parameters.Parameter>> getParametersListFromAnnotation​(io.swagger.v3.oas.annotations.Parameter[] parameters, javax.ws.rs.Consumes classConsumes, javax.ws.rs.Consumes methodConsumes, io.swagger.v3.oas.models.Operation operation, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)  
      protected io.swagger.v3.oas.models.Paths getPaths()  
      protected Class<?> getSubResourceWithJaxRsSubresourceLocatorSpecs​(Method method)  
      protected boolean ignoreOperationPath​(String path, String parentPath)  
      protected boolean ignoreOperationPathStrict​(String path, String parentPath)  
      protected boolean isMethodOverridden​(Method method, Class<?> cls)  
      protected boolean isOperationHidden​(Method method)  
      protected io.swagger.v3.oas.models.Operation parseMethod​(Class<?> cls, Method method, List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<io.swagger.v3.oas.models.security.SecurityRequirement> classSecurityRequirements, Optional<io.swagger.v3.oas.models.ExternalDocumentation> classExternalDocs, Set<String> classTags, List<io.swagger.v3.oas.models.servers.Server> classServers, boolean isSubresource, io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody, io.swagger.v3.oas.models.responses.ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, io.swagger.v3.oas.annotations.responses.ApiResponse[] classResponses, com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)  
      io.swagger.v3.oas.models.Operation parseMethod​(Method method, List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)  
      io.swagger.v3.oas.models.Operation parseMethod​(Method method, List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<io.swagger.v3.oas.models.security.SecurityRequirement> classSecurityRequirements, Optional<io.swagger.v3.oas.models.ExternalDocumentation> classExternalDocs, Set<String> classTags, List<io.swagger.v3.oas.models.servers.Server> classServers, boolean isSubresource, io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody, io.swagger.v3.oas.models.responses.ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, io.swagger.v3.oas.annotations.responses.ApiResponse[] classResponses)  
      io.swagger.v3.oas.models.Operation parseMethod​(Method method, List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters, javax.ws.rs.Produces methodProduces, javax.ws.rs.Produces classProduces, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<io.swagger.v3.oas.models.security.SecurityRequirement> classSecurityRequirements, Optional<io.swagger.v3.oas.models.ExternalDocumentation> classExternalDocs, Set<String> classTags, List<io.swagger.v3.oas.models.servers.Server> classServers, boolean isSubresource, io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody, io.swagger.v3.oas.models.responses.ApiResponses parentResponses, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, io.swagger.v3.oas.annotations.responses.ApiResponse[] classResponses, com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)  
      protected io.swagger.v3.oas.models.media.Content processContent​(io.swagger.v3.oas.models.media.Content content, io.swagger.v3.oas.models.media.Schema<?> schema, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes)  
      protected void processRequestBody​(io.swagger.v3.oas.models.parameters.Parameter requestBodyParameter, io.swagger.v3.oas.models.Operation operation, javax.ws.rs.Consumes methodConsumes, javax.ws.rs.Consumes classConsumes, List<io.swagger.v3.oas.models.parameters.Parameter> operationParameters, Annotation[] paramAnnotations, Type type, com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation, Map<String,​io.swagger.v3.oas.models.media.Encoding> encoding)  
      io.swagger.v3.oas.models.OpenAPI read​(Class<?> cls)
      Scans a single class for Swagger annotations - does not invoke ReaderListeners
      io.swagger.v3.oas.models.OpenAPI read​(Class<?> cls, String parentPath, String parentMethod, boolean isSubresource, io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody, io.swagger.v3.oas.models.responses.ApiResponses parentResponses, Set<String> parentTags, List<io.swagger.v3.oas.models.parameters.Parameter> parentParameters, Set<Class<?>> scannedResources)  
      io.swagger.v3.oas.models.OpenAPI read​(Set<Class<?>> classes)
      Scans a set of classes for both ReaderListeners and OpenAPI annotations.
      io.swagger.v3.oas.models.OpenAPI read​(Set<Class<?>> classes, Map<String,​Object> resources)  
      protected String resolveApplicationPath()  
      protected io.swagger.v3.oas.models.media.Content resolveEmptyContent​(javax.ws.rs.Produces classProduces, javax.ws.rs.Produces methodProduces)  
      protected void resolveResponseSchemaFromReturnType​(io.swagger.v3.oas.models.Operation operation, io.swagger.v3.oas.annotations.responses.ApiResponse[] responses, io.swagger.v3.oas.models.media.Schema<?> schema, javax.ws.rs.Produces classProduces, javax.ws.rs.Produces methodProduces)  
      void setApplication​(javax.ws.rs.core.Application application)  
      void setConfiguration​(io.swagger.v3.oas.integration.api.OpenAPIConfiguration openApiConfiguration)  
      protected void setOperationObjectFromApiOperationAnnotation​(io.swagger.v3.oas.models.Operation operation, io.swagger.v3.oas.annotations.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

      • config

        protected io.swagger.v3.oas.integration.api.OpenAPIConfiguration config
    • Constructor Detail

      • Reader

        public Reader()
      • Reader

        public Reader​(io.swagger.v3.oas.models.OpenAPI openAPI)
      • Reader

        public Reader​(io.swagger.v3.oas.integration.api.OpenAPIConfiguration openApiConfiguration)
      • Reader

        protected Reader​(io.swagger.v3.oas.models.OpenAPI openAPI,
                         io.swagger.v3.oas.models.Paths paths,
                         Set<io.swagger.v3.oas.models.tags.Tag> openApiTags,
                         io.swagger.v3.oas.models.Components components)
      • Reader

        protected Reader​(io.swagger.v3.oas.models.OpenAPI openAPI,
                         io.swagger.v3.oas.models.Paths paths,
                         Set<io.swagger.v3.oas.models.tags.Tag> openApiTags,
                         io.swagger.v3.oas.models.Components components,
                         io.swagger.v3.oas.integration.api.OpenAPIConfiguration openApiConfiguration)
    • Method Detail

      • getOpenAPI

        public io.swagger.v3.oas.models.OpenAPI getOpenAPI()
      • getOpenApiTags

        protected Set<io.swagger.v3.oas.models.tags.Tag> getOpenApiTags()
      • getComponents

        protected io.swagger.v3.oas.models.Components getComponents()
      • getPaths

        protected io.swagger.v3.oas.models.Paths getPaths()
      • read

        public io.swagger.v3.oas.models.OpenAPI read​(Class<?> cls)
        Scans a single class for Swagger annotations - does not invoke ReaderListeners
      • read

        public io.swagger.v3.oas.models.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​(io.swagger.v3.oas.integration.api.OpenAPIConfiguration openApiConfiguration)
        Specified by:
        setConfiguration in interface io.swagger.v3.oas.integration.api.OpenApiReader
      • read

        public io.swagger.v3.oas.models.OpenAPI read​(Set<Class<?>> classes,
                                                     Map<String,​Object> resources)
        Specified by:
        read in interface io.swagger.v3.oas.integration.api.OpenApiReader
      • resolveApplicationPath

        protected String resolveApplicationPath()
      • read

        public io.swagger.v3.oas.models.OpenAPI read​(Class<?> cls,
                                                     String parentPath,
                                                     String parentMethod,
                                                     boolean isSubresource,
                                                     io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody,
                                                     io.swagger.v3.oas.models.responses.ApiResponses parentResponses,
                                                     Set<String> parentTags,
                                                     List<io.swagger.v3.oas.models.parameters.Parameter> parentParameters,
                                                     Set<Class<?>> scannedResources)
      • applyPathParamsPatterns

        protected void applyPathParamsPatterns​(io.swagger.v3.oas.models.Operation operation,
                                               Map<String,​String> patternsMap)
      • processContent

        protected io.swagger.v3.oas.models.media.Content processContent​(io.swagger.v3.oas.models.media.Content content,
                                                                        io.swagger.v3.oas.models.media.Schema<?> schema,
                                                                        javax.ws.rs.Consumes methodConsumes,
                                                                        javax.ws.rs.Consumes classConsumes)
      • processRequestBody

        protected void processRequestBody​(io.swagger.v3.oas.models.parameters.Parameter requestBodyParameter,
                                          io.swagger.v3.oas.models.Operation operation,
                                          javax.ws.rs.Consumes methodConsumes,
                                          javax.ws.rs.Consumes classConsumes,
                                          List<io.swagger.v3.oas.models.parameters.Parameter> operationParameters,
                                          Annotation[] paramAnnotations,
                                          Type type,
                                          com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation,
                                          Map<String,​io.swagger.v3.oas.models.media.Encoding> encoding)
      • parseMethod

        public io.swagger.v3.oas.models.Operation parseMethod​(Method method,
                                                              List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters,
                                                              com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
      • parseMethod

        public io.swagger.v3.oas.models.Operation parseMethod​(Method method,
                                                              List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters,
                                                              javax.ws.rs.Produces methodProduces,
                                                              javax.ws.rs.Produces classProduces,
                                                              javax.ws.rs.Consumes methodConsumes,
                                                              javax.ws.rs.Consumes classConsumes,
                                                              List<io.swagger.v3.oas.models.security.SecurityRequirement> classSecurityRequirements,
                                                              Optional<io.swagger.v3.oas.models.ExternalDocumentation> classExternalDocs,
                                                              Set<String> classTags,
                                                              List<io.swagger.v3.oas.models.servers.Server> classServers,
                                                              boolean isSubresource,
                                                              io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody,
                                                              io.swagger.v3.oas.models.responses.ApiResponses parentResponses,
                                                              com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation,
                                                              io.swagger.v3.oas.annotations.responses.ApiResponse[] classResponses)
      • parseMethod

        public io.swagger.v3.oas.models.Operation parseMethod​(Method method,
                                                              List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters,
                                                              javax.ws.rs.Produces methodProduces,
                                                              javax.ws.rs.Produces classProduces,
                                                              javax.ws.rs.Consumes methodConsumes,
                                                              javax.ws.rs.Consumes classConsumes,
                                                              List<io.swagger.v3.oas.models.security.SecurityRequirement> classSecurityRequirements,
                                                              Optional<io.swagger.v3.oas.models.ExternalDocumentation> classExternalDocs,
                                                              Set<String> classTags,
                                                              List<io.swagger.v3.oas.models.servers.Server> classServers,
                                                              boolean isSubresource,
                                                              io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody,
                                                              io.swagger.v3.oas.models.responses.ApiResponses parentResponses,
                                                              com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation,
                                                              io.swagger.v3.oas.annotations.responses.ApiResponse[] classResponses,
                                                              com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)
      • parseMethod

        protected io.swagger.v3.oas.models.Operation parseMethod​(Class<?> cls,
                                                                 Method method,
                                                                 List<io.swagger.v3.oas.models.parameters.Parameter> globalParameters,
                                                                 javax.ws.rs.Produces methodProduces,
                                                                 javax.ws.rs.Produces classProduces,
                                                                 javax.ws.rs.Consumes methodConsumes,
                                                                 javax.ws.rs.Consumes classConsumes,
                                                                 List<io.swagger.v3.oas.models.security.SecurityRequirement> classSecurityRequirements,
                                                                 Optional<io.swagger.v3.oas.models.ExternalDocumentation> classExternalDocs,
                                                                 Set<String> classTags,
                                                                 List<io.swagger.v3.oas.models.servers.Server> classServers,
                                                                 boolean isSubresource,
                                                                 io.swagger.v3.oas.models.parameters.RequestBody parentRequestBody,
                                                                 io.swagger.v3.oas.models.responses.ApiResponses parentResponses,
                                                                 com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation,
                                                                 io.swagger.v3.oas.annotations.responses.ApiResponse[] classResponses,
                                                                 com.fasterxml.jackson.databind.introspect.AnnotatedMethod annotatedMethod)
      • resolveEmptyContent

        protected io.swagger.v3.oas.models.media.Content resolveEmptyContent​(javax.ws.rs.Produces classProduces,
                                                                             javax.ws.rs.Produces methodProduces)
      • resolveResponseSchemaFromReturnType

        protected void resolveResponseSchemaFromReturnType​(io.swagger.v3.oas.models.Operation operation,
                                                           io.swagger.v3.oas.annotations.responses.ApiResponse[] responses,
                                                           io.swagger.v3.oas.models.media.Schema<?> schema,
                                                           javax.ws.rs.Produces classProduces,
                                                           javax.ws.rs.Produces methodProduces)
      • setOperationObjectFromApiOperationAnnotation

        protected void setOperationObjectFromApiOperationAnnotation​(io.swagger.v3.oas.models.Operation operation,
                                                                    io.swagger.v3.oas.annotations.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)
      • getOperationId

        protected String getOperationId​(String operationId)
      • getParametersListFromAnnotation

        protected Optional<List<io.swagger.v3.oas.models.parameters.Parameter>> getParametersListFromAnnotation​(io.swagger.v3.oas.annotations.Parameter[] parameters,
                                                                                                                javax.ws.rs.Consumes classConsumes,
                                                                                                                javax.ws.rs.Consumes methodConsumes,
                                                                                                                io.swagger.v3.oas.models.Operation operation,
                                                                                                                com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
      • getParameters

        protected ResolvedParameter getParameters​(Type type,
                                                  List<Annotation> annotations,
                                                  io.swagger.v3.oas.models.Operation operation,
                                                  javax.ws.rs.Consumes classConsumes,
                                                  javax.ws.rs.Consumes methodConsumes,
                                                  com.fasterxml.jackson.annotation.JsonView jsonViewAnnotation)
      • isOperationHidden

        protected boolean isOperationHidden​(Method method)
      • isMethodOverridden

        protected boolean isMethodOverridden​(Method method,
                                             Class<?> cls)
      • setApplication

        public void setApplication​(javax.ws.rs.core.Application application)
      • ignoreOperationPath

        protected boolean ignoreOperationPath​(String path,
                                              String parentPath)
      • ignoreOperationPathStrict

        protected boolean ignoreOperationPathStrict​(String path,
                                                    String parentPath)
      • getSubResourceWithJaxRsSubresourceLocatorSpecs

        protected Class<?> getSubResourceWithJaxRsSubresourceLocatorSpecs​(Method method)