Skip to content

OpenAPI_Operation

mattpolzin edited this page Jul 3, 2020 · 12 revisions

OpenAPI.Operation

OpenAPI Spec "Operation Object"

public struct Operation: Equatable, CodableVendorExtendable

See OpenAPI Operation Object.

Inheritance

CodableVendorExtendable, Decodable, Encodable, Equatable

Initializers

init(tags:summary:description:externalDocs:operationId:parameters:requestBody:responses:deprecated:security:servers:vendorExtensions:)

public init(tags: [String]? = nil, summary: String? = nil, description: String? = nil, externalDocs: OpenAPI.ExternalDocumentation? = nil, operationId: String? = nil, parameters: Parameter.Array = [], requestBody: Either<JSONReference<OpenAPI.Request>, OpenAPI.Request>, responses: OpenAPI.Response.Map, deprecated: Bool = false, security: [OpenAPI.SecurityRequirement]? = nil, servers: [OpenAPI.Server]? = nil, vendorExtensions: [String: AnyCodable] = [:])

init(tags:summary:description:externalDocs:operationId:parameters:requestBody:responses:deprecated:security:servers:vendorExtensions:)

public init(tags: [String]? = nil, summary: String? = nil, description: String? = nil, externalDocs: OpenAPI.ExternalDocumentation? = nil, operationId: String? = nil, parameters: Parameter.Array = [], requestBody: OpenAPI.Request? = nil, responses: OpenAPI.Response.Map, deprecated: Bool = false, security: [OpenAPI.SecurityRequirement]? = nil, servers: [OpenAPI.Server]? = nil, vendorExtensions: [String: AnyCodable] = [:])

init(tags:summary:description:externalDocs:operationId:parameters:requestBody:responses:deprecated:security:servers:vendorExtensions:)

public init(tags: String, summary: String? = nil, description: String? = nil, externalDocs: OpenAPI.ExternalDocumentation? = nil, operationId: String? = nil, parameters: Parameter.Array = [], requestBody: OpenAPI.Request? = nil, responses: OpenAPI.Response.Map, deprecated: Bool = false, security: [OpenAPI.SecurityRequirement]? = nil, servers: [OpenAPI.Server]? = nil, vendorExtensions: [String: AnyCodable] = [:])

init(from:)

public init(from decoder: Decoder) throws

Properties

tags

var tags: [String]?

summary

var summary: String?

description

var description: String?

externalDocs

var externalDocs: OpenAPI.ExternalDocumentation?

operationId

var operationId: String?

parameters

var parameters: Parameter.Array

requestBody

var requestBody: Either<JSONReference<OpenAPI.Request>, OpenAPI.Request>?

responses

var responses: OpenAPI.Response.Map

deprecated

Indicates that the operation is deprecated or not.

var deprecated: Bool

By default, deprecated is false.

security

If defined, overrides the security requirements in the root OpenAPI.Document security array.

var security: [OpenAPI.SecurityRequirement]?

Each secutity requirement in this array is an alternative, only one of which must be met for the request to be authorized.

By contrast, all entries in an individual SecurityRequirement (which is itself a dictionary) must be met.

nil indicates this operation uses the security requirements defined at the root of the OpenAPI.Document.

servers

If defined, overrides the servers in the root of the OpenAPI.Document.

var servers: [OpenAPI.Server]?

nil indicates the operation uses the servers defined at the root of the OpenAPI.Document.

vendorExtensions

Dictionary of vendor extensions.

var vendorExtensions: [String: AnyCodable]

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

responseOutcomes

Get all response outcomes for this operation.

var responseOutcomes: [ResponseOutcome]

Returns

An array of ResponseOutcomes with the status and the response for the status.

Methods

encode(to:)

public func encode(to encoder: Encoder) throws
Types
Protocols
Global Functions
Extensions

Clone this wiki locally