Package 

Class OpenApiDocumentation


  • 
    public final class OpenApiDocumentation
    
                        

    OpenApiDocumentation contains OpenAPI documentation for a Handler.

    This class should be modified by the available functions and passed into io.javalin.plugin.openapi.dsl.documented which will include it in the generated documentation.

    • Constructor Detail

      • OpenApiDocumentation

        OpenApiDocumentation()
    • Method Detail

      • operation

         final OpenApiDocumentation operation(Function1<Operation, Unit> applyUpdates)

        Documents the handler using the Operation provided by the input applyUpdates.

        Parameters:
        applyUpdates - A function that returns a Swagger Operation.
      • pathParam

        @JvmOverloads() final OpenApiDocumentation pathParam(String name, Class<?> clazz, OpenApiUpdater<Parameter> openApiUpdater)

        Documents that the handler can receive a path parameter.

        Parameters:
        name - The name of the parameter.
        clazz - The class of the parameter.
        openApiUpdater - A function that allows the underlying Swagger Parameter to modified directly.
      • queryParam

        @JvmOverloads() final OpenApiDocumentation queryParam(String name, Class<?> clazz, Boolean isRepeatable, OpenApiUpdater<Parameter> openApiUpdater)

        Documents that the handler can receive a query parameter.

        queryParam can be called multiple times with different names that represent different parameters, all will be added to the generated documentation.

        Parameters:
        name - The name of the parameter.
        clazz - The class of the parameter.
        isRepeatable - Whether the parameter is repeatable.
        openApiUpdater - A function that allows the underlying Swagger Parameter to modified directly.
      • queryParam

        @JvmOverloads() final OpenApiDocumentation queryParam(String name, Class<?> clazz, Boolean isRepeatable)

        Documents that the handler can receive a query parameter.

        queryParam can be called multiple times with different names that represent different parameters, all will be added to the generated documentation.

        Parameters:
        name - The name of the parameter.
        clazz - The class of the parameter.
        isRepeatable - Whether the parameter is repeatable.
      • queryParam

        @JvmOverloads() final OpenApiDocumentation queryParam(String name, Class<?> clazz)

        Documents that the handler can receive a query parameter.

        queryParam can be called multiple times with different names that represent different parameters, all will be added to the generated documentation.

        Parameters:
        name - The name of the parameter.
        clazz - The class of the parameter.
      • header

        @JvmOverloads() final OpenApiDocumentation header(String name, Class<?> clazz, OpenApiUpdater<Parameter> openApiUpdater)

        Documents that the handler has a header.

        header can be called multiple times with different names that represent different headers, all will be added to the generated documentation.

        Parameters:
        name - The name of the header.
        clazz - The class that represents the header.
        openApiUpdater - A function that allows the underlying Swagger Parameter to modified directly.
      • header

        @JvmOverloads() final OpenApiDocumentation header(String name, Class<?> clazz)

        Documents that the handler has a header.

        header can be called multiple times with different names that represent different headers, all will be added to the generated documentation.

        Parameters:
        name - The name of the header.
        clazz - The class that represents the header.
      • cookie

        @JvmOverloads() final OpenApiDocumentation cookie(String name, Class<?> clazz, OpenApiUpdater<Parameter> openApiUpdater)

        Documents that the handler can receive a cookie.

        cookie can be called multiple times with different names that represent different cookies, all will be added to the generated documentation.

        Parameters:
        name - The name of the cookie.
        clazz - The class that represents the cookie.
        openApiUpdater - A function that allows the underlying Swagger Parameter to modified directly.
      • cookie

        @JvmOverloads() final OpenApiDocumentation cookie(String name, Class<?> clazz)

        Documents that the handler can receive a cookie.

        cookie can be called multiple times with different names that represent different cookies, all will be added to the generated documentation.

        Parameters:
        name - The name of the cookie.
        clazz - The class that represents the cookie.
      • param

         final OpenApiDocumentation param(DocumentedParameter documentedParameter, Boolean isRepeatable, Function1<Parameter, Unit> applyUpdates)

        Documents that the handler can receive a parameter detailed by the input DocumentedParameter.

        param can be called multiple times with different DocumentedParameters that represent different parameters, all will be added to the generated documentation.

        Parameters:
        documentedParameter - The DocumentedParameter the handler can receive.
        isRepeatable - Whether the parameter is repeatable.
        applyUpdates - A function that allows the underlying Swagger Parameter to modified directly.
      • formParam

         final OpenApiDocumentation formParam(String name, Class<?> clazz, Boolean required)

        Documents that the handler can receive a form parameter.

        formParam can be called multiple times with different names that represent different form parameters, all will be added to the generated documentation.

        Parameters:
        name - The name of the parameter.
        clazz - The class of the parameter.
        required - Whether the parameter is required.
      • formParamBody

        @JvmOverloads() final OpenApiDocumentation formParamBody(Class<?> clazz, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body with a content type of application/x-www-form-urlencoded in the form of clazz.

        Parameters:
        clazz - The class that the handler can receive in its request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • formParamBody

        @JvmOverloads() final OpenApiDocumentation formParamBody(Class<?> clazz)

        Documents that the handler can receive a request body with a content type of application/x-www-form-urlencoded in the form of clazz.

        Parameters:
        clazz - The class that the handler can receive in its request body.
      • formParamBody

         final OpenApiDocumentation formParamBody(Class<?> clazz, String contentType, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body with the input contentType in the form of clazz.

        If no contentType is provided then a content type of application/x-www-form-urlencoded is used.

        Parameters:
        clazz - The class that the handler can receive in its request body.
        contentType - The content type of the request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • uploadedFile

         final OpenApiDocumentation uploadedFile(String name, Function1<RequestBody, Unit> applyUpdates)

        Documents that the handler can receive a file with the input name.

        uploadedFile can be called multiple times with different names that represent different files, all will be added to the generated documentation.

        Parameters:
        name - The name of the uploaded files.
        applyUpdates - A function that allows the underlying Swagger RequestBody to modified directly.
      • uploadedFile

        @JvmOverloads() final OpenApiDocumentation uploadedFile(String name, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a file with the input name.

        uploadedFile can be called multiple times with different names that represent different files, all will be added to the generated documentation.

        Parameters:
        name - The name of the uploaded files.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • uploadedFiles

         final OpenApiDocumentation uploadedFiles(String name, Function1<RequestBody, Unit> applyUpdates)

        Documents that the handler can receive files with the input name.

        uploadedFiles can be called multiple times with different names that represent different files, all will be added to the generated documentation.

        Parameters:
        name - The name of the uploaded files.
        applyUpdates - A function that allows the underlying Swagger RequestBody to modified directly.
      • uploadedFiles

        @JvmOverloads() final OpenApiDocumentation uploadedFiles(String name, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive files with the input name.

        uploadedFiles can be called multiple times with different names that represent different files, all will be added to the generated documentation.

        Parameters:
        name - The name of the uploaded files.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • body

         final OpenApiDocumentation body(Class<?> returnType, String contentType, Function1<RequestBody, Unit> applyUpdates)

        Documents that the handler can receive a request body in the form of returnType.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        returnType - The class that the handler can receive in its request body.
        contentType - The content type of the request body.
        applyUpdates - A function that allows the underlying Swagger RequestBody to modified directly.
      • body

         final OpenApiDocumentation body(Class<?> returnType, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body in the form of returnType.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        returnType - The class that the handler can receive in its request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Composition composition, String contentType, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body in the form of the input composition.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        composition - The Composition that the handler can receive in its request body.
        contentType - The content type of the request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Composition composition, String contentType)

        Documents that the handler can receive a request body in the form of the input composition.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        composition - The Composition that the handler can receive in its request body.
        contentType - The content type of the request body.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Composition composition)

        Documents that the handler can receive a request body in the form of the input composition.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        composition - The Composition that the handler can receive in its request body.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Class<?> returnType, String contentType, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body in the form of returnType.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        returnType - The class that the handler can receive in its request body.
        contentType - The content type of the request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Class<?> returnType, String contentType)

        Documents that the handler can receive a request body in the form of returnType.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        returnType - The class that the handler can receive in its request body.
        contentType - The content type of the request body.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Class<?> returnType)

        Documents that the handler can receive a request body in the form of returnType.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        returnType - The class that the handler can receive in its request body.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Schema<?> schema, String contentType, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body in the form of the input Schema.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        schema - The Schema that the handler can receive in its request body.
        contentType - The content type of the request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • body

        @JvmOverloads() final OpenApiDocumentation body(Schema<?> schema, String contentType)

        Documents that the handler can receive a request body in the form of the input Schema.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        schema - The Schema that the handler can receive in its request body.
        contentType - The content type of the request body.
      • body

        @JvmOverloads() final OpenApiDocumentation body(List<DocumentedContent> content, OpenApiUpdater<RequestBody> openApiUpdater, String contentType, ComposedType composedType)

        Documents that the handler can receive a request body in the form of the input DocumentedRequestBody.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        content - The DocumentedContents that the handler can receive in its request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
        contentType - The content type of the request body.
        composedType - The ComposedType of the request body's content.
      • body

        @JvmOverloads() final OpenApiDocumentation body(List<DocumentedContent> content, OpenApiUpdater<RequestBody> openApiUpdater, String contentType)

        Documents that the handler can receive a request body in the form of the input DocumentedRequestBody.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        content - The DocumentedContents that the handler can receive in its request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
        contentType - The content type of the request body.
      • body

        @JvmOverloads() final OpenApiDocumentation body(List<DocumentedContent> content, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body in the form of the input DocumentedRequestBody.

        body can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        content - The DocumentedContents that the handler can receive in its request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • bodyAsBytes

        @JvmOverloads() final OpenApiDocumentation bodyAsBytes(String contentType, Function1<RequestBody, Unit> applyUpdates)

        Documents that the handler can receive a request body with the input contentType in the form of bytes.

        bodyAsBytes can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        contentType - The content type of the request body.
        applyUpdates - A function that allows the underlying Swagger RequestBody to modified directly.
      • bodyAsBytes

        @JvmOverloads() final OpenApiDocumentation bodyAsBytes(Function1<RequestBody, Unit> applyUpdates)

        Documents that the handler can receive a request body with the input contentType in the form of bytes.

        bodyAsBytes can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        applyUpdates - A function that allows the underlying Swagger RequestBody to modified directly.
      • bodyAsBytes

        @JvmOverloads() final OpenApiDocumentation bodyAsBytes(String contentType, OpenApiUpdater<RequestBody> openApiUpdater)

        Documents that the handler can receive a request body with the input contentType in the form of bytes.

        bodyAsBytes can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        contentType - The content type of the request body.
        openApiUpdater - A function that allows the underlying Swagger RequestBody to modified directly.
      • bodyAsBytes

        @JvmOverloads() final OpenApiDocumentation bodyAsBytes(String contentType)

        Documents that the handler can receive a request body with the input contentType in the form of bytes.

        bodyAsBytes can be called multiple times that represent different request bodies, all will be added to the generated documentation.

        Parameters:
        contentType - The content type of the request body.
      • jsonArray

        @JvmOverloads() final OpenApiDocumentation jsonArray(String status, Class<?> returnType, OpenApiUpdater<ApiResponse> openApiUpdater)

        Documents that the handler can return the input status code where the response body will contain application/json representing an array of returnType.

        A schema will be added to represent class T in the documentation.

        jsonArray can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
        openApiUpdater - A function that allows the underlying Swagger ApiResponse to modified directly.
      • jsonArray

        @JvmOverloads() final OpenApiDocumentation jsonArray(String status, Class<?> returnType)

        Documents that the handler can return the input status code where the response body will contain application/json representing an array of returnType.

        A schema will be added to represent class T in the documentation.

        jsonArray can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
      • json

        @JvmOverloads() final OpenApiDocumentation json(String status, Class<?> returnType, OpenApiUpdater<ApiResponse> openApiUpdater)

        Documents that the handler can return the input status code where the response body will contain application/json in the form of returnType.

        A schema will be added to represent class returnType in the documentation.

        json can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
        openApiUpdater - A function that allows the underlying Swagger ApiResponse to modified directly.
      • json

        @JvmOverloads() final OpenApiDocumentation json(String status, Class<?> returnType)

        Documents that the handler can return the input status code where the response body will contain application/json in the form of returnType.

        A schema will be added to represent class returnType in the documentation.

        json can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
      • html

         final OpenApiDocumentation html(String status, Function1<ApiResponse, Unit> applyUpdates)

        Documents that the handler can return the input status code where the response body will contain text/html

        html can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        applyUpdates - A function that allows the underlying Swagger ApiResponse to modified directly.
      • html

        @JvmOverloads() final OpenApiDocumentation html(String status, OpenApiUpdater<ApiResponse> openApiUpdater)

        Documents that the handler can return the input status code where the response body will contain text/html

        html can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        openApiUpdater - A function that allows the underlying Swagger ApiResponse to modified directly.
      • html

        @JvmOverloads() final OpenApiDocumentation html(String status)

        Documents that the handler can return the input status code where the response body will contain text/html

        html can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status, Class<?> returnType, OpenApiUpdater<ApiResponse> openApiUpdater)

        Documents that the handler can return the input status code where the response body will contain returnType.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
        openApiUpdater - A function that allows the underlying Swagger ApiResponse to modified directly.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status, Class<?> returnType)

        Documents that the handler can return the input status code where the response body will contain returnType.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status)

        Documents that the handler can return the input status code where the response body will contain returnType.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status, Class<?> returnType, String contentType, OpenApiUpdater<ApiResponse> openApiUpdater)

        Documents that the handler can return the input status code where the response body will contain contentType in the form of returnType.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
        openApiUpdater - A function that allows the underlying Swagger ApiResponse to modified directly.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status, Class<?> returnType, String contentType)

        Documents that the handler can return the input status code where the response body will contain contentType in the form of returnType.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        returnType - The class that the documented response body contains.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status, Composition.OneOf composition, Function1<ApiResponse, Unit> applyUpdates)

        Documents that the handler can return the input status code where the response body could contain different classes represented by Composition.OneOf.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        composition - The classes that could be contained in the documented response body.
        applyUpdates - A function that allows the underlying Swagger ApiResponse to modified directly.
      • result

        @JvmOverloads() final OpenApiDocumentation result(String status, Composition.OneOf composition)

        Documents that the handler can return the input status code where the response body could contain different classes represented by Composition.OneOf.

        result can be called multiple times with different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        composition - The classes that could be contained in the documented response body.
      • result

         final OpenApiDocumentation result(DocumentedResponse documentedResponse, Function1<ApiResponse, Unit> applyUpdates)

        Documents that the handler can return the input DocumentedResponse.

        result can be called multiple times with different DocumentedResponses that represent different status codes, all will be added to the generated documentation.

        Parameters:
        documentedResponse - The DocumentedResponse to use.
        applyUpdates - A function that allows the underlying Swagger ApiResponse to modified directly.
      • result

         final OpenApiDocumentation result(String status, DocumentedContent content, OpenApiUpdater<ApiResponse> updater)

        Documents that the handler can return the input status code where the response body will contain the input DocumentedContent.

        result can be called multiple times with different DocumentedResponses that represent different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        content - The DocumentedContent that the documented response body contains.
        updater - A function that allows the underlying Swagger ApiResponse to modified directly.
      • result

         final OpenApiDocumentation result(String status, List<DocumentedContent> content, OpenApiUpdater<ApiResponse> updater)

        Documents that the handler can return the input status code where the response body could contain the input DocumentedContents.

        result can be called multiple times with different DocumentedResponses that represent different status codes, all will be added to the generated documentation.

        Parameters:
        status - The status code to document.
        content - The DocumentedContents that the documented response body could contain.
        updater - A function that allows the underlying Swagger ApiResponse to modified directly.