-
public final class OpenApiOptions
-
-
Field Summary
Fields Modifier and Type Field Description private String
path
private Set<RouteRole>
roles
private SwaggerOptions
swagger
private ReDocOptions
reDoc
private DefaultDocumentation
default
private ObjectMapper
jacksonMapper
private ModelConverterFactory
modelConverterFactory
private ToJsonMapper
toJsonMapper
private OpenApiModelModifier
responseModifier
private Set<String>
packagePrefixesToScan
private List<HandlerMetaInfo>
overriddenDocumentation
private List<Pair<String, List<HttpMethod>>>
ignoredPaths
private final List<Pair<String, List<HttpMethod>>>
includedPaths
private Boolean
validateSchema
private Boolean
cacheSchema
private final InitialConfigurationCreator
initialConfigurationCreator
-
Constructor Summary
Constructors Constructor Description OpenApiOptions(Info info)
OpenApiOptions(InitialConfigurationCreator initialConfigurationCreator)
-
Method Summary
Modifier and Type Method Description final String
getPath()
If not null, creates a GET route to get the schema as a json final Unit
setPath(String path)
If not null, creates a GET route to get the schema as a json final Set<RouteRole>
getRoles()
final Unit
setRoles(Set<RouteRole> roles)
final SwaggerOptions
getSwagger()
If not null, creates a GET route to the swagger ui final Unit
setSwagger(SwaggerOptions swagger)
If not null, creates a GET route to the swagger ui final ReDocOptions
getReDoc()
If not null, creates a GET route to the reDoc ui final Unit
setReDoc(ReDocOptions reDoc)
If not null, creates a GET route to the reDoc ui final DefaultDocumentation
getDefault()
Function that is applied to every new operation. final Unit
setDefault(DefaultDocumentation default)
Function that is applied to every new operation. final ObjectMapper
getJacksonMapper()
The default jackson mapper used, for "modelConverterFactory" and "toJsonMapper" if not overridden. final Unit
setJacksonMapper(ObjectMapper jacksonMapper)
The default jackson mapper used, for "modelConverterFactory" and "toJsonMapper" if not overridden. final ModelConverterFactory
getModelConverterFactory()
Creates a model converter, which converts a class to an open api schema. final Unit
setModelConverterFactory(ModelConverterFactory modelConverterFactory)
Creates a model converter, which converts a class to an open api schema. final ToJsonMapper
getToJsonMapper()
The json mapper for creating the object api schema json. final Unit
setToJsonMapper(ToJsonMapper toJsonMapper)
The json mapper for creating the object api schema json. final OpenApiModelModifier
getResponseModifier()
Function that allows modification of the OpenAPI model before it is sent to the client. final Unit
setResponseModifier(OpenApiModelModifier responseModifier)
Function that allows modification of the OpenAPI model before it is sent to the client. final Set<String>
getPackagePrefixesToScan()
A list of package prefixes to scan for annotations. final Unit
setPackagePrefixesToScan(Set<String> packagePrefixesToScan)
A list of package prefixes to scan for annotations. final List<HandlerMetaInfo>
getOverriddenDocumentation()
Manual set the documentation of specific paths final Unit
setOverriddenDocumentation(List<HandlerMetaInfo> overriddenDocumentation)
Manual set the documentation of specific paths final List<Pair<String, List<HttpMethod>>>
getIgnoredPaths()
A list of paths to ignore in documentation final Unit
setIgnoredPaths(List<Pair<String, List<HttpMethod>>> ignoredPaths)
A list of paths to ignore in documentation final List<Pair<String, List<HttpMethod>>>
getIncludedPaths()
A list of the only paths which will be considered as part of the OpenAPI documentation. final Boolean
getValidateSchema()
Validate the generated schema with the swagger parser (prints warnings if schema is invalid) final Unit
setValidateSchema(Boolean validateSchema)
Validate the generated schema with the swagger parser (prints warnings if schema is invalid) final Boolean
getCacheSchema()
Flag indicating whether or not the generated schema should be cached. final Unit
setCacheSchema(Boolean cacheSchema)
Flag indicating whether or not the generated schema should be cached. final InitialConfigurationCreator
getInitialConfigurationCreator()
final OpenApiOptions
path(String value)
final OpenApiOptions
disableCaching()
final OpenApiOptions
responseModifier(OpenApiModelModifier value)
final OpenApiOptions
swagger(SwaggerOptions value)
final OpenApiOptions
reDoc(ReDocOptions value)
final OpenApiOptions
roles(RouteRole value)
final OpenApiOptions
defaultDocumentation(DefaultDocumentation value)
final OpenApiOptions
defaultDocumentation(Function1<OpenApiDocumentation, Unit> apply)
final Unit
examples(Map<Class<?>, Map<String, Example>> examples)
final <T extends Any> Unit
addExample(Class<T> clazz, String name, Example example)
final OpenApiOptions
activateAnnotationScanningFor(String packagePrefixes)
Activate annotation scanning for specific package prefixes. final OpenApiOptions
jacksonMapper(ObjectMapper value)
final OpenApiOptions
modelConverterFactory(ModelConverterFactory value)
final OpenApiOptions
toJsonMapper(ToJsonMapper value)
final String
getFullDocumentationUrl(Context ctx)
final OpenApiOptions
setDocumentation(String path, HttpMethod method, OpenApiDocumentation documentation)
final OpenApiOptions
validateSchema(Boolean validate)
final OpenApiOptions
ignorePath(String path, HttpMethod httpMethod)
final OpenApiOptions
includePath(String path, HttpMethod httpMethod)
adds the given path and methods to the list of paths which should be scanned by OpenAPI -
-
Constructor Detail
-
OpenApiOptions
OpenApiOptions(Info info)
-
OpenApiOptions
OpenApiOptions(InitialConfigurationCreator initialConfigurationCreator)
-
-
Method Detail
-
setPath
final Unit setPath(String path)
If not null, creates a GET route to get the schema as a json
-
getSwagger
final SwaggerOptions getSwagger()
If not null, creates a GET route to the swagger ui
-
setSwagger
final Unit setSwagger(SwaggerOptions swagger)
If not null, creates a GET route to the swagger ui
-
getReDoc
final ReDocOptions getReDoc()
If not null, creates a GET route to the reDoc ui
-
setReDoc
final Unit setReDoc(ReDocOptions reDoc)
If not null, creates a GET route to the reDoc ui
-
getDefault
final DefaultDocumentation getDefault()
Function that is applied to every new operation. You can use this to set defaults (like a 500 response).
-
setDefault
final Unit setDefault(DefaultDocumentation default)
Function that is applied to every new operation. You can use this to set defaults (like a 500 response).
-
getJacksonMapper
final ObjectMapper getJacksonMapper()
The default jackson mapper used, for "modelConverterFactory" and "toJsonMapper" if not overridden.
-
setJacksonMapper
final Unit setJacksonMapper(ObjectMapper jacksonMapper)
The default jackson mapper used, for "modelConverterFactory" and "toJsonMapper" if not overridden.
-
getModelConverterFactory
final ModelConverterFactory getModelConverterFactory()
Creates a model converter, which converts a class to an open api schema. Defaults to the jackson converter.
-
setModelConverterFactory
final Unit setModelConverterFactory(ModelConverterFactory modelConverterFactory)
Creates a model converter, which converts a class to an open api schema. Defaults to the jackson converter.
-
getToJsonMapper
final ToJsonMapper getToJsonMapper()
The json mapper for creating the object api schema json. This is separated from the default JavalinJson mappers.
-
setToJsonMapper
final Unit setToJsonMapper(ToJsonMapper toJsonMapper)
The json mapper for creating the object api schema json. This is separated from the default JavalinJson mappers.
-
getResponseModifier
final OpenApiModelModifier getResponseModifier()
Function that allows modification of the OpenAPI model before it is sent to the client. Since the OpenAPI model is mutable, care should be taken to make sure any modifications are idempotent. If this is not possible, caching of the model may be disabled, but this incurs a performance penalty.
-
setResponseModifier
final Unit setResponseModifier(OpenApiModelModifier responseModifier)
Function that allows modification of the OpenAPI model before it is sent to the client. Since the OpenAPI model is mutable, care should be taken to make sure any modifications are idempotent. If this is not possible, caching of the model may be disabled, but this incurs a performance penalty.
-
getPackagePrefixesToScan
final Set<String> getPackagePrefixesToScan()
A list of package prefixes to scan for annotations.
-
setPackagePrefixesToScan
final Unit setPackagePrefixesToScan(Set<String> packagePrefixesToScan)
A list of package prefixes to scan for annotations.
-
getOverriddenDocumentation
final List<HandlerMetaInfo> getOverriddenDocumentation()
Manual set the documentation of specific paths
-
setOverriddenDocumentation
final Unit setOverriddenDocumentation(List<HandlerMetaInfo> overriddenDocumentation)
Manual set the documentation of specific paths
-
getIgnoredPaths
final List<Pair<String, List<HttpMethod>>> getIgnoredPaths()
A list of paths to ignore in documentation
-
setIgnoredPaths
final Unit setIgnoredPaths(List<Pair<String, List<HttpMethod>>> ignoredPaths)
A list of paths to ignore in documentation
-
getIncludedPaths
final List<Pair<String, List<HttpMethod>>> getIncludedPaths()
A list of the only paths which will be considered as part of the OpenAPI documentation. If this list is empty it will be considered as meaning that all paths should be included with the exception of the ignored paths
-
getValidateSchema
final Boolean getValidateSchema()
Validate the generated schema with the swagger parser (prints warnings if schema is invalid)
-
setValidateSchema
final Unit setValidateSchema(Boolean validateSchema)
Validate the generated schema with the swagger parser (prints warnings if schema is invalid)
-
getCacheSchema
final Boolean getCacheSchema()
Flag indicating whether or not the generated schema should be cached. Caching is enabled by default.
-
setCacheSchema
final Unit setCacheSchema(Boolean cacheSchema)
Flag indicating whether or not the generated schema should be cached. Caching is enabled by default.
-
getInitialConfigurationCreator
final InitialConfigurationCreator getInitialConfigurationCreator()
-
path
final OpenApiOptions path(String value)
-
disableCaching
final OpenApiOptions disableCaching()
-
responseModifier
final OpenApiOptions responseModifier(OpenApiModelModifier value)
-
swagger
final OpenApiOptions swagger(SwaggerOptions value)
-
reDoc
final OpenApiOptions reDoc(ReDocOptions value)
-
roles
final OpenApiOptions roles(RouteRole value)
-
defaultDocumentation
final OpenApiOptions defaultDocumentation(DefaultDocumentation value)
-
defaultDocumentation
final OpenApiOptions defaultDocumentation(Function1<OpenApiDocumentation, Unit> apply)
-
addExample
final <T extends Any> Unit addExample(Class<T> clazz, String name, Example example)
-
activateAnnotationScanningFor
final OpenApiOptions activateAnnotationScanningFor(String packagePrefixes)
Activate annotation scanning for specific package prefixes. This will search for
OpenApi
annotations which define thepath
andmethod
* property. If an handler with the same path and method is added and the handler doesn't have any documentation or the documentation cannot be accessed by reflection, the annotation will be used. Currently this is just required for java method references.
-
jacksonMapper
final OpenApiOptions jacksonMapper(ObjectMapper value)
-
modelConverterFactory
final OpenApiOptions modelConverterFactory(ModelConverterFactory value)
-
toJsonMapper
final OpenApiOptions toJsonMapper(ToJsonMapper value)
-
getFullDocumentationUrl
final String getFullDocumentationUrl(Context ctx)
-
setDocumentation
final OpenApiOptions setDocumentation(String path, HttpMethod method, OpenApiDocumentation documentation)
-
validateSchema
final OpenApiOptions validateSchema(Boolean validate)
-
ignorePath
final OpenApiOptions ignorePath(String path, HttpMethod httpMethod)
-
includePath
final OpenApiOptions includePath(String path, HttpMethod httpMethod)
adds the given path and methods to the list of paths which should be scanned by OpenAPI
- Parameters:
path
- : the path to include in the paths to scanhttpMethod
- : the list of http methods to include in the scan (as a vararg)
-
-
-
-