Skip to content

ResolvedRoute

mattpolzin edited this page Jul 3, 2020 · 3 revisions

ResolvedRoute

The canonical definition of a route. All information from throughout the OpenAPI document that is relevant to a particular route is collected and exposed in this type.

public struct ResolvedRoute: Equatable

You can access resolved routes via the ResolvedDocument type. You make a ResolvedDocument from an OpenAPI.Document by calling:

try document
    .locallyDereferenced()
    .resolved()

See ResolvedDocument for more information.

Inheritance

Equatable

Initializers

init(summary:description:vendorExtensions:path:parameters:servers:endpoints:)

Create a ResolvedRoute.

internal init(summary: String?, description: String?, vendorExtensions: [String: AnyCodable], path: OpenAPI.Path, parameters: [DereferencedParameter], servers: [OpenAPI.Server], endpoints: [ResolvedEndpoint])

ResolvedRoute creation is only publicly exposed by methods on ResolvedDocument and DereferencedDocument.

Important: The endpoints passed in must each be associated with a different HTTP method. Naturally a route can only define one operation for each method.

Properties

summary

The summary of this route.

let summary: String?

description

The description of this route.

let description: String?

vendorExtensions

The OpenAPI Specification Extensions available on this route.

let vendorExtensions: [String :AnyCodable]

path

The path at which this route is exposed.

let path: OpenAPI.Path

parameters

All parameters that apply to all endpoints at this route. This array does not include parameters that apply to some but not all endpoints.

let parameters: [DereferencedParameter]

For a comprehensive array of parameters relevant to any particular endpoint, use the ResolvedEndpoint parameters property. That property will contain both parameters that are relevant to all endpoints at this route and also parameters only relevant to the given endpoint.

servers

The list of servers that support this route.

let servers: [OpenAPI.Server]

get

The HTTP GET endpoint at this route.

let get: ResolvedEndpoint?

put

The HTTP PUT endpoint at this route.

let put: ResolvedEndpoint?

post

The HTTP POST endpoint at this route.

let post: ResolvedEndpoint?

delete

The HTTP DELETE endpoint at this route.

let delete: ResolvedEndpoint?

options

The HTTP OPTIONS endpoint at this route.

let options: ResolvedEndpoint?

head

The HTTP HEAD endpoint at this route.

let head: ResolvedEndpoint?

patch

The HTTP PATCH endpoint at this route.

let patch: ResolvedEndpoint?

trace

The HTTP TRACE endpoint at this route.

let trace: ResolvedEndpoint?

endpoints

An array of all endpoints at this route.

var endpoints: [ResolvedEndpoint]

Methods

`for`(_:)

Retrieve the endpoint for the given method, if one exists for this route.

public func `for`(_ verb: OpenAPI.HttpMethod) -> ResolvedEndpoint?
Types
Protocols
Global Functions
Extensions
Clone this wiki locally