Package guru.zoroark.tegral.openapi.dsl

Types

Link copied to clipboard
abstract class BodyBuilder(context: OpenApiDslContext) : BodyDsl

A default builder for anything that needs to implement BodyDsl.

Link copied to clipboard
interface BodyDsl : PredefinedContentTypesDsl

DSL for body-like objects, i.e. objects that contain a "content" property.

Link copied to clipboard
fun interface Builder<out T>

Interface for anything that "builds" into T.

Link copied to clipboard
data class ContentType(val contentType: String)

A content type.

Link copied to clipboard
class InfoBuilder : Builder<Info> , InfoDsl

Builder object for the info object.

Link copied to clipboard
interface InfoDsl

DSL for the info object.

Link copied to clipboard
class MediaTypeBuilder(context: OpenApiDslContext) : MediaTypeDsl, Builder<MediaType>

A builder for MediaTypeDsl.

Link copied to clipboard
interface MediaTypeDsl

DSL for media type objects(https://spec.openapis.org/oas/v3.1.0#media-type-object

Link copied to clipboard
data class MultiContentType(val types: List<ContentType>)

Represents multiple content types. This is useful for functions that can be applied to multiple content types at a time (mostly for the sake of concision).

Link copied to clipboard
interface OpenApiDslContext

This interface is passed to most of the builder classes and provides utilities that need to be present through the "DSL tree".

Link copied to clipboard
enum OpenApiVersion : Enum<OpenApiVersion>

A version of the OpenAPI standard. This only includes the x.y part of the x.y.z version scheme.

Link copied to clipboard
class OperationBuilder(context: OpenApiDslContext) : OperationDsl, Builder<Operation>

Builder for OperationDsl

Link copied to clipboard
interface OperationDsl

DSL for the operation object.

Link copied to clipboard
class ParameterBuilder(    context: OpenApiDslContext,     name: String,     kind: ParameterKind) : Builder<Parameter> , ParameterDsl

Builder for ParameterDsl

Link copied to clipboard
interface ParameterDsl : MediaTypeDsl

DSL for https://spec.openapis.org/oas/v3.1.0#parameter-object

Link copied to clipboard
enum ParameterKind : Enum<ParameterKind>

The kind of parameter (i.e. its location).

Link copied to clipboard
class PathBuilder(context: OpenApiDslContext) : PathDsl, Builder<PathItem>

Builder for PathDsl

Link copied to clipboard
interface PathDsl

DSL for the path item object.

Link copied to clipboard
class PathsBuilder(context: OpenApiDslContext) : PathsDsl, Builder<Paths>

Builder for PathsDsl.

Link copied to clipboard
interface PathsDsl

DSL for the paths object.

Link copied to clipboard
interface PredefinedContentTypesDsl

Interface that contains standard content types.

Link copied to clipboard
class RequestBodyBuilder(context: OpenApiDslContext) : BodyBuilder, RequestBodyDsl, Builder<RequestBody>

Builder for the request body DSL

Link copied to clipboard
interface RequestBodyDsl : BodyDsl

DSL for the request body object.

Link copied to clipboard
class ResponseBuilder(context: OpenApiDslContext) : BodyBuilder, ResponseDsl, Builder<ApiResponse>

Builder for Response objects, implementing the ResponseDsl.

Link copied to clipboard
interface ResponseDsl : BodyDsl

DSL for https://spec.openapis.org/oas/v3.1.0#response-object.

Link copied to clipboard
class RootBuilder(    context: OpenApiDslContext,     infoBuilder: InfoBuilder = InfoBuilder(),     paths: PathsBuilder = PathsBuilder(context),     securitySchemes: MutableMap<String, SecuritySchemeBuilder> = mutableMapOf()) : RootDsl, InfoDsl, PathsDsl, Builder<OpenAPI>

Builder for the RootDsl.

Link copied to clipboard
interface RootDsl : InfoDsl, TagsDsl, PathsDsl

This is the root DSL object for the Tegral OpenAPI DSL.

Link copied to clipboard
class SecuritySchemeBuilder : SecuritySchemeDsl, Builder<SecurityScheme>

Builder for the security scheme DSL.

Link copied to clipboard
interface SecuritySchemeDsl
Link copied to clipboard
class ServerBuilder(url: String) : ServerDsl, Builder<Server>

Builder for ServerDsl.

Link copied to clipboard
interface ServerDsl

DSL for the server object.

Link copied to clipboard
class SimpleDslContext : OpenApiDslContext

An implementation of OpenApiDslContext that keeps context information for Swagger Core.

Link copied to clipboard
class TagBuilder(name: String) : TagDsl, Builder<Tag>

Actual builder for TagDsl.

Link copied to clipboard
interface TagDsl

DSL for the tag object.

Link copied to clipboard
interface TagsDsl

DSL for the objects that can contain tags listed by name.

Functions

Link copied to clipboard
fun openApi(builder: RootDsl.() -> Unit): OpenAPI

Entrypoint for the Tegral OpenAPI DSL.

Link copied to clipboard
inline fun <T> MediaTypeDsl.schema()

Set the schema to be of type T.

inline fun <T> MediaTypeDsl.schema(example: T)

Set the schema to be of type T, with the given object set as the example.

fun <T> MediaTypeDsl.schema(ktype: KType, example: T)

Set the schema to be of type ktype, with the given object set as the example.

Link copied to clipboard
fun OpenAPI.toJson(version: OpenApiVersion = OpenApiVersion.V3_0): String

Dumps this OpenAPI object to a JSON string.

Link copied to clipboard
fun OpenAPI.toOpenApi31(): OpenAPI

Converts this OpenAPI object to a version 3.1 OpenAPI object.

Link copied to clipboard
fun OpenAPI.toYaml(version: OpenApiVersion = OpenApiVersion.V3_0): String

Dumps this OpenAPI object to a prettified YAML string.

Properties

Link copied to clipboard
val SecuritySchemeDsl.apiKeyType: Unit

Sets the type of this security scheme to API key.

Link copied to clipboard
val SecuritySchemeDsl.httpType: Unit

Sets the type of this security scheme to HTTP.

Link copied to clipboard
val SecuritySchemeDsl.inCookie: Unit

Sets the location of this security scheme to be in a cookie.

Link copied to clipboard
val SecuritySchemeDsl.inHeader: Unit

Sets the location of this security scheme to be in a header.

Link copied to clipboard
val SecuritySchemeDsl.inQuery: Unit

Sets the location of this security scheme to be in a query parameter.

Link copied to clipboard
val SecuritySchemeDsl.mutualTlsType: Unit

Sets the type of this security scheme to Mutual TLS.

Link copied to clipboard
val SecuritySchemeDsl.oauth2Type: Unit

Sets the type of this security scheme to OAuth 2.

Link copied to clipboard
val SecuritySchemeDsl.openIdConnectType: Unit

Sets the type of this security scheme to OpenID Connect.