OpenAPI

zio.http.endpoint.openapi.OpenAPI
See theOpenAPI companion class
object OpenAPI

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
OpenAPI.type

Members list

Type members

Classlikes

final case class Callback(expressions: Map[String, PathItem])

A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item 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.

A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item 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.

Value parameters

expressions

A Path Item Object used to define a callback request and expected responses.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Callback

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Callback.type
final case class Components(schemas: ListMap[Key, ReferenceOr[JsonSchema]], responses: ListMap[Key, ReferenceOr[Response]], parameters: ListMap[Key, ReferenceOr[Parameter]], examples: ListMap[Key, ReferenceOr[Example]], requestBodies: ListMap[Key, ReferenceOr[RequestBody]], headers: ListMap[Key, ReferenceOr[Header]], securitySchemes: ListMap[Key, ReferenceOr[SecurityScheme]], links: ListMap[Key, ReferenceOr[Link]], callbacks: ListMap[Key, ReferenceOr[Callback]])

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

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

Value parameters

callbacks

An object to hold reusable Callback Objects.

examples

An object to hold reusable Example Objects.

headers

An object to hold reusable Header Objects.

links

An object to hold reusable Link Objects.

parameters

An object to hold reusable Parameter Objects.

requestBodies

An object to hold reusable Request Body Objects.

responses

An object to hold reusable Response Objects.

schemas

An object to hold reusable Schema Objects.

securitySchemes

An object to hold reusable Security Scheme Objects.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Contact(name: Option[String], url: Option[URI], email: Option[String])

Contact information for the exposed API.

Contact information for the exposed API.

Value parameters

email

The email address of the contact person/organization. MUST be in the format of an email address.

name

The identifying name of the contact person/organization.

url

The URL pointing to the contact information.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Discriminator(propertyName: String, mapping: Map[String, String])

When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

When request bodies or response payloads may be one of a number of different schemas, a discriminator object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.

When using the discriminator, inline schemas will not be considered.

Value parameters

mapping

An object to hold mappings between payload values and schema names or references.

propertyName

The name of the property in the payload that will hold the discriminator value.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Discriminator

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Encoding(contentType: String, headers: Map[String, ReferenceOr[Header]], style: String, explode: Boolean, allowReserved: Boolean)

A single encoding definition applied to a single schema property.

A single encoding definition applied to a single schema property.

TODO: default values (https://spec.openapis.org/oas/v3.0.3#encoding-object)

Value parameters

allowReserved

Determines whether the parameter value SHOULD allow reserved characters, as defined by [RFC3986] to be included without percent-encoding. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

contentType

The Content-Type for encoding a specific property.

explode

When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map.

headers

A map allowing additional information to be provided as headers, for example Content-Disposition. Content-Type is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a multipart.

style

Describes how a specific property value will be serialized depending on its type. This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Encoding

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Encoding.type
final case class Example(value: Json, summary: Option[String], description: Option[Doc], externalValue: Option[URI])

In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.

In all cases, the example value is expected to be compatible with the type schema of its associated value. Tooling implementations MAY choose to validate compatibility automatically, and reject the example value(s) if incompatible.

Value parameters

description

Long description for the example.

externalValue

A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents.

summary

Short description for the example.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Example

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Example.type
final case class ExternalDoc(description: Option[Doc], url: URI)

Allows referencing an external resource for extended documentation.

Allows referencing an external resource for extended documentation.

Value parameters

description

A short description of the target documentation. CommonMark syntax MAY be used for rich text representation.

url

The URL for the target documentation.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Header(description: Option[Doc], required: Option[Boolean], deprecated: Option[Boolean], allowEmptyValue: Option[Boolean], schema: Option[JsonSchema])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Header

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Header.type
final case class Info(title: String, description: Option[Doc], termsOfService: Option[URI], contact: Option[Contact], license: Option[License], version: String)

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.

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.

Value parameters

contact

The contact information for the exposed API.

description

A short description of the API.

license

The license information for the exposed API.

termsOfService

A URL to the Terms of Service for the API.

title

The title of the API.

version

The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed abstract case class Key

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Key

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
Key.type
final case class License(name: String, url: Option[URI])

License information for the exposed API.

License information for the exposed API.

Value parameters

name

The license name used for the API.

url

A URL to the license used for the API.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Link(operationRef: URI, parameters: Map[String, LiteralOrExpression], requestBody: LiteralOrExpression, description: Option[Doc], server: Option[Server])

The Link object 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, rather it provides a known relationship and traversal mechanism between responses and other operations.

The Link object 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, rather it provides a known relationship and traversal mechanism between responses and other operations.

Unlike dynamic links (i.e. links provided in the response payload), the OAS linking mechanism does not require link information in the runtime response.

For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.

Value parameters

description

A description of the link.

operationRef

A relative or absolute URI reference to an OAS operation. This field MUST point to an Operation Object. Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.

parameters

A map representing parameters to pass to an operation as identified via operationRef. The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation. The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).

requestBody

A literal value or {expression} to use as a request body when calling the target operation.

server

A server object to be used by the target operation.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Link

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Link.type

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait LiteralOrExpression

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
final case class MediaType(schema: ReferenceOr[JsonSchema], examples: Map[String, ReferenceOr[Example]], encoding: Map[String, Encoding])

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

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

Value parameters

encoding

A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property. The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.

examples

Examples of the media type. Each example object SHOULD match the media type and specified schema if present. If referencing a schema which contains an example, the examples value SHALL override the example provided by the schema.

schema

The schema defining the content of the request, response, or parameter.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object MediaType

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
MediaType.type
final case class Operation(tags: List[String], summary: Option[String], description: Option[Doc], externalDocs: Option[ExternalDoc], operationId: Option[String], parameters: Set[ReferenceOr[Parameter]], requestBody: Option[ReferenceOr[RequestBody]], responses: Map[StatusOrDefault, ReferenceOr[Response]], callbacks: Map[String, ReferenceOr[Callback]], deprecated: Option[Boolean], security: List[SecurityRequirement], servers: List[Server])

Describes a single API operation on a path.

Describes a single API operation on a path.

Value parameters

callbacks

A map of possible out-of band callbacks related to the parent operation. The key is a unique identifier for the Callback Object. Each value in the map is a Callback Object that describes a request that may be initiated by the API provider and the expected responses.

deprecated

Declares this operation to be deprecated. Consumers SHOULD refrain from usage of the declared operation.

description

A verbose explanation of the operation behavior.

externalDocs

Additional external documentation for this operation.

operationId

Unique string used to identify the operation. The id MUST be unique among all operations described in the API. The operationId value is case-sensitive. Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions.

parameters

A List of parameters that are applicable for this operation. If a parameter is already defined at the Path Item, the new definition will override it but can never remove it. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters.

requestBody

The request body applicable for this operation. The requestBody is only supported in HTTP methods where the HTTP 1.1 specification [RFC7231] has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.

responses

The List of possible responses as they are returned from executing this operation.

security

A declaration of which security mechanisms can be used for this operation. The List of values includes alternative security requirement objects that can be used. Only one of the security requirement objects need to be satisfied to authorize a request. To make security optional, an empty security requirement ({}) can be included in the array. This definition overrides any declared top-level security. To remove a top-level security declaration, an empty List can be used.

servers

An alternative server List to service this operation. If an alternative server object is specified at the Path Item Object or Root level, it will be overridden by this value.

summary

A short summary of what the operation does.

tags

A list of tags for API documentation control. Tags can be used for logical grouping of operations by resources or any other qualifier.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Parameter(name: String, in: String, description: Option[Doc], required: Option[Boolean], deprecated: Option[Boolean], schema: Option[ReferenceOr[JsonSchema]], explode: Option[Boolean], examples: Map[String, ReferenceOr[Example]], allowReserved: Option[Boolean], style: Option[String], content: Option[(String, MediaType)])

Describes a single operation parameter.

Describes a single operation parameter.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Parameter

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Parameter.type
case class Path

The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.

The path is appended (no relative URL resolution) to the expanded URL from the Server Object's url field in order to construct the full URL. Path templating is allowed. When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it’s up to the tooling to decide which one to use.

Value parameters

name

The field name of the relative path MUST begin with a forward slash (/).

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Path

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Path.type
final case class PathItem(ref: Option[String], summary: Option[String], description: Option[Doc], get: Option[Operation], put: Option[Operation], post: Option[Operation], delete: Option[Operation], options: Option[Operation], head: Option[Operation], patch: Option[Operation], trace: Option[Operation], servers: List[Server], parameters: Set[ReferenceOr[Parameter]])

Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.

Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.

Value parameters

delete

A definition of a DELETE operation on this path.

description

A description, intended to apply to all operations in this path.

get

A definition of a GET operation on this path.

head

A definition of a HEAD operation on this path.

options

A definition of a OPTIONS operation on this path.

parameters

A Set of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The Set can use the Reference Object to link to parameters that are defined at the OpenAPI Object’s components/parameters.

patch

A definition of a PATCH operation on this path.

post

A definition of a POST operation on this path.

put

A definition of a PUT operation on this path.

ref

Allows for an external definition of this path item. The referenced structure MUST be in the format of a Path Item Object. In case a Path Item Object field appears both in the defined object and the referenced object, the behavior is undefined.

servers

An alternative server List to service all operations in this path.

summary

An optional, string summary, intended to apply to all operations in this path.

trace

A definition of a TRACE operation on this path.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object PathItem

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
PathItem.type
object ReferenceOr

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait ReferenceOr[+T]

A simple object to allow referencing other components in the specification, internally and externally.

A simple object to allow referencing other components in the specification, internally and externally.

Value parameters

ref

The reference string.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Or[T]
class Reference
final case class RequestBody(description: Option[Doc], content: Map[String, MediaType], required: Boolean)

Describes a single request body.

Describes a single request body.

Value parameters

content

The content of the request body. The key is a media type or [media type range]appendix-D) and the value describes it. For requests that match multiple keys, only the most specific key is applicable.

description

A brief description of the request body. This could contain examples of use.

required

Determines if the request body is required in the request.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object RequestBody

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Response(description: Option[Doc], headers: Map[String, ReferenceOr[Header]], content: Map[String, MediaType], links: Map[String, ReferenceOr[Link]])

Describes a single response from an API Operation, including design-time, static links to operations based on the response.

Describes a single response from an API Operation, including design-time, static links to operations based on the response.

Value parameters

content

A map containing descriptions of potential response payloads. The key is a media type or [media type range]appendix-D) and the value describes it. For responses that match multiple keys, only the most specific key is applicable.

description

A short description of the response.

headers

Maps a header name to its definition. [RFC7230] states header names are case insensitive. If a response header is defined with the name "Content-Type", it SHALL be ignored.

links

A map of operations links that can be followed from the response. The key of the map is a short name for the link, following the naming constraints of the names for Component Objects.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Response

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Response.type

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait SecurityScheme

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class ApiKey
class Http
class OAuth2
final case class Server(url: URI, description: Option[Doc], variables: Map[String, ServerVariable])

An object representing a Server.

An object representing a Server.

Value parameters

description

Describing the host designated by the URL.

url

A URL to the target host. This URL supports Server Variables and MAY be relative, to indicate that the host location is relative to the location where the OpenAPI document is being served. Variable substitutions will be made when a variable is named in {brackets}.

variables

A map between a variable name and its value. The value is used for substitution in the server’s URL template.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class ServerVariable(enum: Chunk[String], default: String, description: Doc)

An object representing a Server Variable for server URL template substitution.

An object representing a Server Variable for server URL template substitution.

Value parameters

default

The default value to use for substitution, which SHALL be sent if an alternate value is not supplied. Note this behavior is different than the Schema Object’s treatment of default values, because in those cases parameter values are optional. If the enum is defined, the value SHOULD exist in the enum’s values.

description

A description for the server variable.

enum

An enumeration of string values to be used if the substitution options are from a limited set.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
sealed trait StatusOrDefault extends Product, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
object Default.type
class StatusValue
final case class Tag(name: String, description: Option[Doc], externalDocs: Option[ExternalDoc])

Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.

Value parameters

description

A short description for the tag.

externalDocs

Additional external documentation for this tag.

name

The name of the tag.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class XML(name: String, namespace: URI, prefix: String, attribute: Boolean, wrapped: Boolean)

A metadata object that allows for more fine-tuned XML model definitions.

A metadata object that allows for more fine-tuned XML model definitions.

When using arrays, XML element names are not inferred (for singular/plural forms) and the name property SHOULD be used to add that information.

Value parameters

attribute

Declares whether the property definition translates to an attribute instead of an element.

name

Replaces the name of the element/attribute used for the described schema property. When defined within items, it will affect the name of the individual XML elements within the list. When defined alongside type being array (outside the items), it will affect the wrapping element and only if wrapped is true. If wrapped is false, it will be ignored.

namespace

The URI of the namespace definition.

prefix

The prefix to be used for the name.

wrapped

MAY be used only for an array definition. Signifies whether the array is wrapped (for example, ) or unwrapped (). The definition takes effect only when defined alongside type being array (outside the items).

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Types

A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The Responses Object MUST contain at least one response code, and it SHOULD be the response for a successful operation call.

Attributes

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def empty: OpenAPI
def fromJson(json: String): Either[String, OpenAPI]

Implicits

Implicits

implicit def keyMapSchema[T](implicit schema: Schema[T]): Schema[ListMap[Key, T]]
implicit def mediaTypeTupleSchema: Schema[(String, MediaType)]
implicit def pathMapSchema: Schema[ListMap[Path, PathItem]]
implicit val schema: Schema[OpenAPI]
implicit def statusMapSchema[T](implicit schema: Schema[T]): Schema[Map[StatusOrDefault, T]]
implicit def statusSchema: Schema[Status]