Interface AnnotationScanner

    • Method Detail

      • scan

        org.eclipse.microprofile.openapi.models.OpenAPI scan​(AnnotationScannerContext annotationScannerContext,
                                                             org.eclipse.microprofile.openapi.models.OpenAPI oai)
      • isAsyncResponse

        boolean isAsyncResponse​(org.jboss.jandex.MethodInfo method)
      • isPostMethod

        boolean isPostMethod​(org.jboss.jandex.MethodInfo method)
      • isDeleteMethod

        boolean isDeleteMethod​(org.jboss.jandex.MethodInfo method)
      • setContextRoot

        void setContextRoot​(String path)
      • isMultipartOutput

        default boolean isMultipartOutput​(org.jboss.jandex.Type returnType)
      • isMultipartInput

        default boolean isMultipartInput​(org.jboss.jandex.Type inputType)
      • isScannerInternalResponse

        default boolean isScannerInternalResponse​(org.jboss.jandex.Type returnType)
      • isScannerInternalParameter

        default boolean isScannerInternalParameter​(org.jboss.jandex.Type parameterType)
      • isWrapperType

        default boolean isWrapperType​(org.jboss.jandex.Type type)
      • unwrapType

        default org.jboss.jandex.Type unwrapType​(org.jboss.jandex.Type type)
      • processDefinitionAnnotation

        default void processDefinitionAnnotation​(AnnotationScannerContext context,
                                                 org.jboss.jandex.ClassInfo targetClass,
                                                 org.eclipse.microprofile.openapi.models.OpenAPI openApi)
        Process a certain class for OpenApiDefinition annotations.
        Parameters:
        context - the scanning context
        targetClass - the class that contain the server annotation
        openApi - the current OpenApi model being created
      • processSecuritySchemeAnnotation

        default void processSecuritySchemeAnnotation​(AnnotationScannerContext context,
                                                     org.jboss.jandex.ClassInfo targetClass,
                                                     org.eclipse.microprofile.openapi.models.OpenAPI openApi)
        Process a certain class for security annotations.
        Parameters:
        targetClass - the class that contain the security annotation
        openApi - the current OpenApi model being created
      • processServerAnnotation

        default void processServerAnnotation​(org.jboss.jandex.ClassInfo targetClass,
                                             org.eclipse.microprofile.openapi.models.OpenAPI openApi)
        Process a certain class for server annotations.
        Parameters:
        targetClass - the class that contain the server annotation
        openApi - the current OpenApi model being created
      • processJavaSecurity

        default void processJavaSecurity​(org.jboss.jandex.ClassInfo resourceClass,
                                         org.eclipse.microprofile.openapi.models.OpenAPI openApi)
        Process Java security (roles allowed and declared roles)
        Parameters:
        openApi - the OpenAPI Model
        resourceClass - the Class being scanned
      • processOperationTags

        default void processOperationTags​(AnnotationScannerContext context,
                                          org.jboss.jandex.MethodInfo method,
                                          org.eclipse.microprofile.openapi.models.OpenAPI openApi,
                                          Set<String> resourceTags,
                                          org.eclipse.microprofile.openapi.models.Operation operation)
        Process tags. Tag and Tags annotations combines with the resource tags we've already found (passed in)
        Parameters:
        method - the REST method
        openApi - the OpenApi model
        resourceTags - tags passed in
        operation - the current operation
      • processTags

        default Set<String> processTags​(AnnotationScannerContext context,
                                        org.jboss.jandex.AnnotationTarget target,
                                        org.eclipse.microprofile.openapi.models.OpenAPI openApi,
                                        boolean nullWhenMissing)
        Processes any Tag or Tags annotations present on the annotation target and adds them to the OpenAPI model. The set of tag names found (with iteration order preserved) is returned.
        Parameters:
        openApi - OpenAPI model
        target - a MethodInfo or ClassInfo to read for tag annotations
        nullWhenMissing - determines if an empty set or a null value is returned when no annotations are found.
        Returns:
        the set of tag names found
      • getResourceMethods

        default List<org.jboss.jandex.MethodInfo> getResourceMethods​(AnnotationScannerContext context,
                                                                     org.jboss.jandex.ClassInfo resource)
        Extracts all methods from the provided class and its ancestors that are known to the instance's index
        Parameters:
        context - the scanning context
        resource - the resource class
        Returns:
        all methods from the provided class and its ancestors
      • processOperation

        default Optional<org.eclipse.microprofile.openapi.models.Operation> processOperation​(AnnotationScannerContext context,
                                                                                             org.jboss.jandex.ClassInfo resourceClass,
                                                                                             org.jboss.jandex.MethodInfo method)
        While scanning JAX-RS/Spring method, find the operations
        Parameters:
        context - the scanning context
        resourceClass - the JAX-RS/Spring concrete resource class
        method - the JAX-RS/Spring method
        Returns:
        Maybe an Operation model
      • processResponse

        default void processResponse​(AnnotationScannerContext context,
                                     org.jboss.jandex.MethodInfo method,
                                     org.eclipse.microprofile.openapi.models.Operation operation,
                                     Map<org.jboss.jandex.DotName,​org.jboss.jandex.AnnotationInstance> exceptionAnnotationMap)
      • createResponseFromRestMethod

        default void createResponseFromRestMethod​(AnnotationScannerContext context,
                                                  org.jboss.jandex.MethodInfo method,
                                                  org.eclipse.microprofile.openapi.models.Operation operation)
        Called when a scanner (jax-rs, spring) method's APIResponse annotations have all been processed but no response was actually created for the operation.This method will create a response from the method information and add it to the given operation. It will try to do this by examining the method's return value and the type of operation (GET, PUT, POST, DELETE). If there is a return value of some kind (a non-void return type) then the response code is assumed to be 200. If there not a return value (void return type) then either a 201 or 204 is returned, depending on the type of request. TODO: generate responses for each checked exception?
        Parameters:
        context - the scanning context
        method - the current method
        operation - the current operation
      • getDefaultStatus

        default int getDefaultStatus​(org.jboss.jandex.MethodInfo method)
        Derives a default HTTP status code for the provided REST endpoint implementation method using the rules defined by @APIResponseSchema#responseCode().
        Parameters:
        method - the endpoint method
        Returns:
        the derived HTTP status
      • isVoidResponse

        default boolean isVoidResponse​(org.jboss.jandex.MethodInfo method)
      • isScannerInternalResponse

        default boolean isScannerInternalResponse​(org.jboss.jandex.Type returnType,
                                                  AnnotationScannerContext context,
                                                  org.jboss.jandex.MethodInfo method)
      • hasKotlinContinuation

        default boolean hasKotlinContinuation​(org.jboss.jandex.MethodInfo method)
      • isKotlinContinuation

        default boolean isKotlinContinuation​(org.jboss.jandex.Type paramType)
      • getKotlinContinuationArgument

        default org.jboss.jandex.Type getKotlinContinuationArgument​(AnnotationScannerContext context,
                                                                    org.jboss.jandex.MethodInfo method)
      • kotlinContinuationToSchema

        default org.eclipse.microprofile.openapi.models.media.Schema kotlinContinuationToSchema​(AnnotationScannerContext context,
                                                                                                org.jboss.jandex.MethodInfo method)
      • generateResponse

        default boolean generateResponse​(String status,
                                         org.eclipse.microprofile.openapi.models.Operation operation)
        Determine if the default response information should be generated. It should be done when no responses have been declared or if the default response already exists and is missing information (e.g. content).
        Parameters:
        status - the status determined to be the generated default
        operation - current operation
        Returns:
        true if a default response should be generated, otherwise false.
      • addApiReponseFromAnnotation

        default void addApiReponseFromAnnotation​(AnnotationScannerContext context,
                                                 org.jboss.jandex.AnnotationInstance apiResponseAnnotation,
                                                 org.eclipse.microprofile.openapi.models.Operation operation)
        Add api response to api responses using the annotation information
        Parameters:
        context - The current scanning context
        apiResponseAnnotation - The api response annotation
        operation - The method operation
      • addApiReponseSchemaFromAnnotation

        default void addApiReponseSchemaFromAnnotation​(AnnotationScannerContext context,
                                                       org.jboss.jandex.AnnotationInstance annotation,
                                                       org.jboss.jandex.MethodInfo method,
                                                       org.eclipse.microprofile.openapi.models.Operation operation)
        Add api response to api responses using the annotation information
        Parameters:
        context - the scanning context
        annotation - The APIResponseSchema annotation
        method - the current method
        operation - the method operation
      • responseCodeExistInMethodAnnotations

        default boolean responseCodeExistInMethodAnnotations​(AnnotationScannerContext context,
                                                             org.jboss.jandex.AnnotationInstance exMapperApiResponseAnnotation,
                                                             List<org.jboss.jandex.AnnotationInstance> methodApiResponseAnnotations)
        Check if the response code declared in the ExceptionMapper already defined in one of the ApiReponse annotations of the method. If the response code already exists then ignore the exception mapper annotation.
        Parameters:
        exMapperApiResponseAnnotation - ApiResponse annotation declared in the exception mapper
        methodApiResponseAnnotations - List of ApiResponse annotations declared in the jax-rs/spring method.
        Returns:
        response code exist or not
      • processSecurityRequirementAnnotation

        default void processSecurityRequirementAnnotation​(org.jboss.jandex.ClassInfo resourceClass,
                                                          org.jboss.jandex.MethodInfo method,
                                                          org.eclipse.microprofile.openapi.models.Operation operation)
        Get the security requirements on method and class and add them to the openapi model
        Parameters:
        resourceClass - the class
        method - the method
        operation - the operation to add them to
      • isEmptySecurityRequirements

        default boolean isEmptySecurityRequirements​(org.jboss.jandex.AnnotationTarget target)
        Determines whether the target is annotated with an empty @SecurityRequirements annotation.
        Parameters:
        target -
        Returns:
        true if an empty annotation is present, otherwise false
      • processCallback

        default void processCallback​(AnnotationScannerContext context,
                                     org.jboss.jandex.MethodInfo method,
                                     org.eclipse.microprofile.openapi.models.Operation operation)
        Process a callback annotation
        Parameters:
        context - the scanning context
        method - the method
        operation - the operation to add this to
      • processServerAnnotation

        default void processServerAnnotation​(org.jboss.jandex.MethodInfo method,
                                             org.eclipse.microprofile.openapi.models.Operation operation)
        Process a certain method for server annotations.
        Parameters:
        method - the method that contain the server annotation
        operation - the current Operation model being created
      • processExtensions

        default void processExtensions​(AnnotationScannerContext context,
                                       org.jboss.jandex.MethodInfo method,
                                       org.eclipse.microprofile.openapi.models.Operation operation)
        Process the Extensions annotations
        Parameters:
        context - the scanning context
        method - the current REST method
        operation - the current operation
      • setOperationOnPathItem

        default void setOperationOnPathItem​(org.eclipse.microprofile.openapi.models.PathItem.HttpMethod methodType,
                                            org.eclipse.microprofile.openapi.models.PathItem pathItem,
                                            org.eclipse.microprofile.openapi.models.Operation operation)
        Set the created operation to the pathItem
        Parameters:
        methodType - the HTTP method type
        pathItem - the pathItem to set
        operation - the operation
      • processScannerExtensions

        default void processScannerExtensions​(AnnotationScannerContext context,
                                              Collection<org.jboss.jandex.ClassInfo> applications)
        Scan for scanner extensions
        Parameters:
        context - the scanning context
        applications - the scanner applications
      • processRequestBody

        default org.eclipse.microprofile.openapi.models.parameters.RequestBody processRequestBody​(AnnotationScannerContext context,
                                                                                                  org.jboss.jandex.MethodInfo method,
                                                                                                  ResourceParameters params)
        Process the request body
        Parameters:
        context - the current scanning context
        method - the resource method
        params - the params
        Returns:
        RequestBody model
      • getRequestBodyParameterClassType

        default org.jboss.jandex.Type getRequestBodyParameterClassType​(AnnotationScannerContext context,
                                                                       org.jboss.jandex.MethodInfo method,
                                                                       ResourceParameters params)
        Go through the method parameters looking for one that is not annotated with a jax-rs/spring annotation.That will be the one that is the request body.
        Parameters:
        context - the scanning context
        method - MethodInfo
        params - the current parameters
        Returns:
        Type
      • getReasonPhrase

        default String getReasonPhrase​(int statusCode)
        Get the default description for a HTTP Status code
        Parameters:
        statusCode -
        Returns:
        the reason