Skip to content

OpenAPI_PathItem

mattpolzin edited this page Oct 1, 2020 · 9 revisions

OpenAPI.PathItem

OpenAPI Spec "Path Item Object"

public struct PathItem: Equatable, CodableVendorExtendable

See OpenAPI Path Item Object.

Inheritance

CodableVendorExtendable, Decodable, Encodable, Equatable, LocallyDereferenceable

Nested Type Aliases

Map

public typealias Map = OrderedDictionary<OpenAPI.Path, OpenAPI.PathItem>

Initializers

init(summary:description:servers:parameters:get:put:post:delete:options:head:patch:trace:vendorExtensions:)

public init(summary: String? = nil, description: String? = nil, servers: [OpenAPI.Server]? = nil, parameters: Parameter.Array = [], get: Operation? = nil, put: Operation? = nil, post: Operation? = nil, delete: Operation? = nil, options: Operation? = nil, head: Operation? = nil, patch: Operation? = nil, trace: Operation? = nil, vendorExtensions: [String: AnyCodable] = [:])

init(from:)

public init(from decoder: Decoder) throws

Properties

summary

var summary: String?

description

var description: String?

servers

var servers: [OpenAPI.Server]?

parameters

var parameters: Parameter.Array

get

var get: Operation?

put

var put: Operation?

post

var post: Operation?

delete

var delete: Operation?

options

var options: Operation?

head

var head: Operation?

patch

var patch: Operation?

trace

var trace: Operation?

vendorExtensions

Dictionary of vendor extensions.

var vendorExtensions: [String: AnyCodable]

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

endpoints

Get all endpoints defined at this path.

var endpoints: [Endpoint]

Returns

An array of Endpoints with the method (i.e. .get) and the operation for the method.

Methods

dereferenced(in:)

Create a DereferencedPathItem if all references in the path item can be found in the given Components Object.

public func dereferenced(in components: OpenAPI.Components) throws -> DereferencedPathItem

Throws

ReferenceError.cannotLookupRemoteReference or ReferenceError.missingOnLookup(name:​key:​) depending on whether an unresolvable reference points to another file or just points to a component in the same file that cannot be found in the Components Object.

get(_:)

Set the GET endpoint operation.

public mutating func get(_ op: Operation?)

put(_:)

Set the PUT endpoint operation.

public mutating func put(_ op: Operation?)

post(_:)

Set the POST endpoint operation.

public mutating func post(_ op: Operation?)

delete(_:)

Set the DELETE endpoint operation.

public mutating func delete(_ op: Operation?)

options(_:)

Set the OPTIONS endpoint operation.

public mutating func options(_ op: Operation?)

head(_:)

Set the HEAD endpoint operation.

public mutating func head(_ op: Operation?)

patch(_:)

Set the PATCH endpoint operation.

public mutating func patch(_ op: Operation?)

trace(_:)

Set the TRACE endpoint operation.

public mutating func trace(_ op: Operation?)

`for`(_:)

Retrieve the operation for the given verb, if one is set for this path.

public func `for`(_ verb: OpenAPI.HttpMethod) -> OpenAPI.Operation?

set(operation:for:)

Set the operation for the given verb, overwriting any already set operation for the same verb.

public mutating func set(operation: OpenAPI.Operation?, for verb: OpenAPI.HttpMethod)

encode(to:)

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