Package-level declarations

Types

Link copied to clipboard

Represents the OpenAPI Schema Object's additionalProperties field. It can be either a boolean that allows or forbids additional properties, or a schema reference describing the type of those additional properties.

Link copied to clipboard
data class ApiKeySecurityScheme(val name: String? = null, val in: SecuritySchemeIn? = null, val description: String? = null, val extensions: ExtensionProperties? = null) : SecurityScheme, Extensible

Describes an API Key-based security scheme for OpenAPI 3.0+ specifications.

Link copied to clipboard
value class Callback(val value: Map<String, PathItem>)

A map of possible out-of band callbacks related to the parent operation. Each value in the map is a PathItem Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the path item object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.

Link copied to clipboard
data class Components(val schemas: Map<String, JsonSchema>? = null, val responses: Map<String, ReferenceOr<Response>>? = null, val parameters: Map<String, ReferenceOr<Parameter>>? = null, val examples: Map<String, ReferenceOr<ExampleObject>>? = null, val requestBodies: Map<String, ReferenceOr<RequestBody>>? = null, val headers: Map<String, ReferenceOr<Header>>? = null, val securitySchemes: Map<String, ReferenceOr<SecurityScheme>>? = null, val links: Map<String, ReferenceOr<Link>>? = null, val callbacks: Map<String, ReferenceOr<Callback>>? = null, val pathItems: Map<String, ReferenceOr<PathItem>>? = null, val servers: Map<String, ReferenceOr<Server>>? = null, val extensions: ExtensionProperties? = null) : Extensible

Holds a set of reusable objects for different aspects of the OAS. All objects defined within the component object will have no effect on the API unless they are explicitly referenced from properties outside the component object.

Link copied to clipboard
data class Encoding(val contentType: ContentType, val headers: Map<String, ReferenceOr<Header>>? = null, val style: String? = null, val explode: Boolean? = null, val allowReserved: Boolean? = null, val extensions: ExtensionProperties? = null) : Extensible

A single encoding definition applied to a single schema property.

Link copied to clipboard
data class ExampleObject(val summary: String? = null, val description: String? = null, val value: GenericElement? = null, val externalValue: String? = null, val extensions: ExtensionProperties? = null) : Extensible

Example Object (OpenAPI). Represents an example payload/value for a schema.

Link copied to clipboard

A map of arbitrary extension properties, each key starting with "x-".

Link copied to clipboard
data class ExternalDocs(val description: String? = null, val url: String)

Allows referencing an external resource for extended documentation.

Link copied to clipboard

A generalized element for deferred deserialization for use as an interoperable stand in for JSON and YAML nodes.

Link copied to clipboard

Adapter for custom GenericElement types when using different encoders / decoders.

Link copied to clipboard

A GenericElement serializer that delegates to the first registered GenericElementSerialAdapter that can deserialize the element.

Link copied to clipboard
class GenericElementString(val element: String, val elementSerializer: KSerializer<String> = String.serializer()) : GenericElement

A GenericElement implementation that wraps a string value.

Link copied to clipboard
class GenericElementWrapper<T : Any>(val element: T, val elementSerializer: KSerializer<T>) : GenericElement

A GenericElement implementation that wraps a value of type T.

Link copied to clipboard
data class Header(val description: String? = null, val required: Boolean = false, val deprecated: Boolean = false, val schema: ReferenceOr<JsonSchema>? = null, val content: Map<@Serializable(with = ContentTypeSerializer::class) ContentType, MediaType>? = null, val style: String? = null, val explode: Boolean? = null, val example: GenericElement? = null, val examples: Map<String, ReferenceOr<ExampleObject>>? = null, val extensions: ExtensionProperties? = null) : Extensible

Header fields have the same meaning as for 'Param'. Style is always treated as Style.simple, as it is the only value allowed for headers.

Link copied to clipboard
data class Headers(val headers: Map<String, Header>)

Container for named headers attached to a response.

Link copied to clipboard
data class HttpSecurityScheme(val scheme: String? = null, val bearerFormat: String? = null, val description: String? = null, val extensions: ExtensionProperties? = null) : SecurityScheme, Extensible

Describes an HTTP-based security scheme.

Link copied to clipboard
data class JsonSchema(val type: @Serializable(with = JsonSchema.SchemaType.Serializer::class) JsonSchema.SchemaType? = null, val title: String? = null, val description: String? = null, val required: List<String>? = null, val allOf: List<ReferenceOr<JsonSchema>>? = null, val oneOf: List<ReferenceOr<JsonSchema>>? = null, val not: ReferenceOr<JsonSchema>? = null, val anyOf: List<ReferenceOr<JsonSchema>>? = null, val properties: Map<String, ReferenceOr<JsonSchema>>? = null, val additionalProperties: AdditionalProperties? = null, val discriminator: JsonSchemaDiscriminator? = null, val readOnly: Boolean? = null, val writeOnly: Boolean? = null, val xml: Xml? = null, val externalDocs: ExternalDocs? = null, val example: GenericElement? = null, val examples: List<GenericElement>? = null, val deprecated: Boolean? = null, val maxProperties: Int? = null, val minProperties: Int? = null, val default: GenericElement? = null, val format: String? = null, val items: ReferenceOr<JsonSchema>? = null, val maximum: Double? = null, val exclusiveMaximum: Double? = null, val minimum: Double? = null, val exclusiveMinimum: Double? = null, val maxLength: Int? = null, val minLength: Int? = null, val pattern: String? = null, val maxItems: Int? = null, val minItems: Int? = null, val uniqueItems: Boolean? = null, val enum: List<GenericElement?>? = null, val multipleOf: Double? = null, val id: String? = null, val anchor: String? = null, val dynamicAnchor: Boolean? = null)

The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.

Link copied to clipboard
data class JsonSchemaDiscriminator(val propertyName: String, val mapping: Map<String, String>? = null)

Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the required property list. When used, the value MUST be the name of this schema or any schema that inherits it.

Link copied to clipboard
fun interface JsonSchemaInference

Context interface for creating schema from type metadata.

Link copied to clipboard

Represents the base data types defined in the JSON Schema specification.

Link copied to clipboard
data class Link(val operationRef: String? = null, val operationId: String? = null, val parameters: ExtensionProperties? = null, val requestBody: GenericElement? = null, val description: String? = null, val server: Server? = null, val extensions: ExtensionProperties? = null) : Extensible

Represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, but it does provide a known relationship and traversal mechanism between responses and other operations.

Link copied to clipboard
data class MediaType(val schema: ReferenceOr<JsonSchema>? = null, val examples: Map<String, ReferenceOr<ExampleObject>>? = null, val encoding: Map<String, Encoding>? = null, val extensions: ExtensionProperties? = null) : Extensible

Each Media Type Object provides schema and examples for the media type identified by its key.

Link copied to clipboard
data class OAuth2SecurityScheme(val flows: OAuthFlows? = null, val description: String? = null, val extensions: ExtensionProperties? = null) : SecurityScheme, Extensible
Link copied to clipboard
data class OAuthFlow(val authorizationUrl: String? = null, val tokenUrl: String? = null, val refreshUrl: String? = null, val scopes: Map<String, String>? = null, val extensions: ExtensionProperties? = null) : Extensible

Configuration details for a supported OAuth Flow.

Link copied to clipboard
data class OAuthFlows(val implicit: OAuthFlow? = null, val password: OAuthFlow? = null, val clientCredentials: OAuthFlow? = null, val authorizationCode: OAuthFlow? = null, val extensions: ExtensionProperties? = null) : Extensible

Allows configuration of the supported OAuth Flows.

Link copied to clipboard
data class OpenApiDoc(val openapi: String = OPENAPI_VERSION, val info: OpenApiInfo, val servers: List<Server>? = null, val paths: Map<String, ReferenceOr<PathItem>> = emptyMap(), val webhooks: Map<String, ReferenceOr<PathItem>>? = null, val components: Components? = null, val security: List<SecurityRequirement>? = null, val tags: List<Tag>? = null, val externalDocs: ExternalDocs? = null, val extensions: Map<String, GenericElement>? = null) : Extensible
Link copied to clipboard
interface OpenApiDocDsl

A small interface exposing the OpenAPI document builder state.

Link copied to clipboard
data class OpenApiInfo(val title: String, val version: String, val description: String? = null, val termsOfService: String? = null, val contact: OpenApiInfo.Contact? = Contact(), val license: OpenApiInfo.License? = null, val extensions: ExtensionProperties? = null) : Extensible

The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.

Link copied to clipboard
data class OpenIdConnectSecurityScheme(val openIdConnectUrl: String? = null, val description: String? = null, val extensions: ExtensionProperties? = null) : SecurityScheme, Extensible
Link copied to clipboard
data class Operation(val operationId: String? = null, val tags: List<String>? = null, val summary: String? = null, val description: String? = null, val externalDocs: ExternalDocs? = null, val parameters: List<ReferenceOr<Parameter>>? = null, val requestBody: ReferenceOr<RequestBody>? = null, val callbacks: Map<String, ReferenceOr<Callback>>? = null, val responses: Responses? = null, val deprecated: Boolean? = null, val security: List<Map<String, List<String>>>? = null, val servers: List<Server>? = null, val extensions: ExtensionProperties? = null) : Extensible

Describes a single API operation on a path item as defined by the OpenAPI Specification. Use Operation.Builder or Operation.build to create instances in a type-safe DSL.

Link copied to clipboard
data class Parameter(val name: String, val in: ParameterType? = null, val description: String? = null, val required: Boolean = false, val deprecated: Boolean = false, val schema: ReferenceOr<JsonSchema>? = null, val content: Map<@Serializable(with = ContentTypeSerializer::class) ContentType, MediaType>? = null, val style: String? = null, val explode: Boolean? = null, val allowReserved: Boolean? = null, val allowEmptyValue: Boolean? = null, val example: GenericElement? = null, val examples: Map<String, ReferenceOr<ExampleObject>>? = null, val extensions: ExtensionProperties? = null) : Extensible

Describes a single operation parameter (path, query, header, or cookie).

Link copied to clipboard
data class Parameters(val parameters: List<Parameter>)

A container for multiple operation Parameter definitions created via Parameters.Builder.

Link copied to clipboard
Link copied to clipboard
data class PathItem(val summary: String? = null, val description: String? = null, val put: Operation? = null, val post: Operation? = null, val delete: Operation? = null, val options: Operation? = null, val get: Operation? = null, val head: Operation? = null, val patch: Operation? = null, val trace: Operation? = null, val servers: List<Server>? = null, val parameters: List<ReferenceOr<Parameter>>? = null, val extensions: ExtensionProperties? = null) : Extensible

Describes the operations, parameters, and servers available for a single API path, as defined by the OpenAPI Specification Path Item Object. This is a container that aggregates the HTTP operations (GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH, TRACE) and common metadata that apply to the path.

Link copied to clipboard

Defines Union A | Reference. A lot of types like Header, Schema, MediaType, etc. can be either a direct value or a reference to a definition.

Link copied to clipboard
data class RequestBody(val description: String? = null, val content: Map<@Serializable(with = ContentTypeSerializer::class) ContentType, MediaType>? = null, val required: Boolean = false, val extensions: ExtensionProperties? = null) : Extensible

Describes the request body for an operation including content types, schemas, and whether it is required.

Link copied to clipboard
data class Response(val description: String, val headers: Map<String, ReferenceOr<Header>>? = null, val content: Map<@Serializable(with = ContentTypeSerializer::class) ContentType, MediaType>? = null, val links: Map<String, ReferenceOr<Link>>? = null, val extensions: ExtensionProperties? = null) : Extensible

Describes a response returned by an operation including description, headers, content, and links.

Link copied to clipboard
data class Responses(val default: ReferenceOr<Response>? = null, val responses: Map<Int, ReferenceOr<Response>>? = null, val extensions: ExtensionProperties? = null) : Extensible

A container for named response objects keyed by HTTP status code or "default".

Link copied to clipboard
Link copied to clipboard
data class Security(val requirements: List<Map<String, List<String>>>)

Represents a list of security requirements (schemes with optional scopes) for an operation.

Link copied to clipboard

Lists the required security schemes to execute this operation. The object can have multiple security schemes declared in it which are all required (that is, there is a logical AND between the schemes).

Link copied to clipboard

Defines a security scheme that can be used by the operations.

Link copied to clipboard

The location of the API key for apiKey type security schemes.

Link copied to clipboard

The type of the security scheme.

Link copied to clipboard
data class Server(val url: String, val description: String? = null, val extensions: ExtensionProperties? = null) : Extensible

Describes a server that hosts the API.

Link copied to clipboard
data class Servers(val servers: List<Server>)

A container for multiple Server definitions used by an operation.

Link copied to clipboard
data class Tag(val name: String, val description: String? = null, val externalDocs: ExternalDocs? = null)

Allows adding metadata to a single tag that is used by @Operation@. It is not mandatory to have a @Tag@ per tag used there.

Link copied to clipboard
data class Xml(val name: String? = null, val namespace: String? = null, val prefix: String? = null, val attribute: Boolean? = null, val wrapped: Boolean? = null, val extensions: ExtensionProperties? = null) : Extensible

Properties

Link copied to clipboard

Infers JSON schema from kotlinx-serialization descriptors.

Functions

Link copied to clipboard
inline fun <T> GenericElement.asA(): T

Deserialize an element to the given type T.

Link copied to clipboard
fun SerialDescriptor.buildJsonSchema(includeTitle: Boolean = true, includeAnnotations: List<Annotation> = emptyList(), visiting: MutableSet<String>): JsonSchema

Generates a JSON Schema representation from a Kotlinx Serialization SerialDescriptor.

Link copied to clipboard
inline fun <T : Any> GenericElement(value: T): GenericElement

Convenience function for creating a GenericElement from a value of type T.

Create an object node GenericElement from the given entries.

inline fun <T : Any> GenericElement(map: Map<String, T>): GenericElement

Create an object node GenericElement from the given map.

Link copied to clipboard

Generates a JSON Schema representation for the given type T.

Link copied to clipboard
fun jsonSchemaFromAnnotations(annotations: List<Annotation>, reflectSchema: KClass<*>.() -> ReferenceOr<JsonSchema>, type: JsonSchema.SchemaType, title: String? = null, required: List<String>? = null, items: ReferenceOr<JsonSchema>? = null, properties: Map<String, ReferenceOr<JsonSchema>>? = null, additionalProperties: AdditionalProperties? = null, enum: List<GenericElement?>? = null, format: String? = null, discriminator: JsonSchemaDiscriminator? = null): JsonSchema

Create an instance of JsonSchema from the provided properties and supplied annotations.

Link copied to clipboard
Link copied to clipboard