Skip to content

OpenAPI_Document

mattpolzin edited this page May 24, 2020 · 11 revisions

OpenAPI.Document

The root of an OpenAPI 3.0 document.

public struct Document: Equatable, CodableVendorExtendable

See OpenAPI Specification.

Inheritance

CodableVendorExtendable, Decodable, Encodable, Equatable

Initializers

init(openAPIVersion:info:servers:paths:components:security:tags:externalDocs:vendorExtensions:)

public init(openAPIVersion: Version = .v3_0_0, info: Info, servers: [Server], paths: PathItem.Map, components: Components, security: [SecurityRequirement] = [], tags: [Tag]? = nil, externalDocs: ExternalDocumentation? = nil, vendorExtensions: [String: AnyCodable] = [:])

init(from:)

public init(from decoder: Decoder) throws

Properties

openAPIVersion

var openAPIVersion: Version

info

var info: Info

servers

var servers: [Server]

paths

var paths: PathItem.Map

components

var components: Components

security

var security: [SecurityRequirement]

tags

var tags: [Tag]?

externalDocs

var externalDocs: ExternalDocumentation?

vendorExtensions

Dictionary of vendor extensions.

var vendorExtensions: [String: AnyCodable]

These should be of the form: [ "x-extensionKey": <anything>] where the values are anything codable.

routes

Get all routes for this document.

var routes: [Route]

Returns

An Array of Routes with the path and the definition of the route.

Methods

encode(to:)

public func encode(to encoder: Encoder) throws
Types
Protocols
Global Functions
Extensions
Clone this wiki locally