-
Notifications
You must be signed in to change notification settings - Fork 39
OpenAPI_Parameter
OpenAPI Spec "Parameter Object"
public struct Parameter: Equatable, CodableVendorExtendable
CodableVendorExtendable
, ComponentDictionaryLocatable
, Decodable
, Encodable
, Equatable
, LocallyDereferenceable
An array of parameters that are Either
Parameters
or references to parameters.
public typealias Array = [Either<JSONReference<OpenAPI.Parameter>, OpenAPI.Parameter>]
You can use the lookup(_:)
or subscript
methods on the OpenAPI.Components
found at
document.components
to resolve an Either
to
an OpenAPI.Parameter
.
Create a parameter with an Either<SchemaContext, OpenAPI.Content.Map>
.
public init(
name: String,
context: Context,
schemaOrContent: Either<SchemaContext, OpenAPI.Content.Map>,
description: String? = nil,
deprecated: Bool = false,
vendorExtensions: [String: AnyCodable] = [:]
)
Create a parameter with a SchemaContext
.
public init(
name: String,
context: Context,
schema: SchemaContext,
description: String? = nil,
deprecated: Bool = false,
vendorExtensions: [String: AnyCodable] = [:]
)
Create a parameter with a JSONSchema
and the default
style
for the given Context
.
public init(
name: String,
context: Context,
schema: JSONSchema,
description: String? = nil,
deprecated: Bool = false,
vendorExtensions: [String: AnyCodable] = [:]
)
Create a parameter with a reference to a JSONSchema
and the default style
for the given Context
.
public init(
name: String,
context: Context,
schemaReference: JSONReference<JSONSchema>,
description: String? = nil,
deprecated: Bool = false,
vendorExtensions: [String: AnyCodable] = [:]
)
Create a parameter with a Content.Map
.
public init(
name: String,
context: Context,
content: OpenAPI.Content.Map,
description: String? = nil,
deprecated: Bool = false,
vendorExtensions: [String: AnyCodable] = [:]
)
public init(from decoder: Decoder) throws
public static var openAPIComponentsKey: String
public static var openAPIComponentsKeyPath: KeyPath<OpenAPI.Components, OpenAPI.ComponentDictionary<Self>>
public var name: String
OpenAPI Spec "in" property determines the Context
.
public var context: Context
This context stores the location (e.g. "query" or "header") of the parameter and any additional information relevant to parameters in the given location.
public var description: String?
public var deprecated: Bool
OpenAPI Spec "content" or "schema" properties.
public var schemaOrContent: Either<SchemaContext, OpenAPI.Content.Map>
You can access the schema context (if it is in use for
this parameter) with schemaOrContent.schemaContextValue
.
The schema context contains lots of information detailed in the
OpenAPI specification under the Parameter Object section.
You can directly access the underlying JSONSchema
with
schemaOrContent.schemaValue
. If the schema is a reference
instead of an inline value, schemaOrContent.schemaReference
will get you the reference.
You can access the content map (if it is in use for
this parameter) with schemaOrContent.contentValue
.
Dictionary of vendor extensions.
public var vendorExtensions: [String: AnyCodable]
These should be of the form:
[ "x-extensionKey": <anything>]
where the values are anything codable.
public var required: Bool
The location (e.g. "query") of the parameter.
public var location: Context.Location
See the context
property for more details on the
parameter.
An internal-use method that facilitates reference cycle detection by tracking past references followed in the course of dereferencing.
public func _dereferenced(
in components: OpenAPI.Components,
following references: Set<AnyHashable>,
dereferencedFromComponentNamed name: String?
) throws -> DereferencedParameter
For all external-use, see dereferenced(in:)
(provided by the LocallyDereferenceable
protocol).
All types that provide a _dereferenced(in:following:)
implementation have a dereferenced(in:)
implementation for free.
public func encode(to encoder: Encoder) throws
.
Types
- AnyCodable
- DereferencedContent
- DereferencedContentEncoding
- DereferencedDocument
- DereferencedDocument.Route
- DereferencedHeader
- DereferencedJSONSchema
- DereferencedJSONSchema.ArrayContext
- DereferencedJSONSchema.ObjectContext
- DereferencedOperation
- DereferencedOperation.ResponseOutcome
- DereferencedParameter
- DereferencedPathItem
- DereferencedPathItem.Endpoint
- DereferencedRequest
- DereferencedResponse
- DereferencedSchemaContext
- DereferencedSecurityRequirement
- DereferencedSecurityRequirement.ScopedScheme
- Either
- EitherDecodeNoTypesMatchedError
- EitherDecodeNoTypesMatchedError.IndividualFailure
- ErrorCategory
- ErrorCategory.KeyValue
- InconsistencyError
- JSONReference
- JSONReference.InternalReference
- JSONReference.Path
- JSONReference.PathComponent
- JSONSchema
- JSONSchema.ArrayContext
- JSONSchema.CoreContext
- JSONSchema.CoreContext.Permissions
- JSONSchema.IntegerContext
- JSONSchema.IntegerContext.Bound
- JSONSchema.NumericContext
- JSONSchema.NumericContext.Bound
- JSONSchema.ObjectContext
- JSONSchema.StringContext
- JSONSchemaResolutionError
- JSONType
- JSONTypeFormat
- JSONTypeFormat.AnyFormat
- JSONTypeFormat.ArrayFormat
- JSONTypeFormat.BooleanFormat
- JSONTypeFormat.IntegerFormat
- JSONTypeFormat.IntegerFormat.Extended
- JSONTypeFormat.NumberFormat
- JSONTypeFormat.ObjectFormat
- JSONTypeFormat.StringFormat
- JSONTypeFormat.StringFormat.Extended
- OpenAPI
- OpenAPI.CallbackURL
- OpenAPI.ComponentKey
- OpenAPI.Components
- OpenAPI.Components.ReferenceCycleError
- OpenAPI.Components.ReferenceError
- OpenAPI.Content
- OpenAPI.Content.Encoding
- OpenAPI.ContentType
- OpenAPI.Discriminator
- OpenAPI.Document
- OpenAPI.Document.Info
- OpenAPI.Document.Info.Contact
- OpenAPI.Document.Info.License
- OpenAPI.Document.Route
- OpenAPI.Document.Version
- OpenAPI.Error
- OpenAPI.Error.Decoding
- OpenAPI.Error.Decoding.Document
- OpenAPI.Error.Decoding.Document.Context
- OpenAPI.Error.Decoding.Operation
- OpenAPI.Error.Decoding.Operation.Context
- OpenAPI.Error.Decoding.Path
- OpenAPI.Error.Decoding.Path.Context
- OpenAPI.Error.Decoding.Request
- OpenAPI.Error.Decoding.Request.Context
- OpenAPI.Error.Decoding.Response
- OpenAPI.Error.Decoding.Response.Context
- OpenAPI.Example
- OpenAPI.ExternalDocumentation
- OpenAPI.Header
- OpenAPI.HttpMethod
- OpenAPI.Link
- OpenAPI.OAuthFlows
- OpenAPI.OAuthFlows.AuthorizationCode
- OpenAPI.OAuthFlows.ClientCredentials
- OpenAPI.OAuthFlows.CommonFields
- OpenAPI.OAuthFlows.Implicit
- OpenAPI.OAuthFlows.Password
- OpenAPI.Operation
- OpenAPI.Operation.ResponseOutcome
- OpenAPI.Parameter
- OpenAPI.Parameter.Context
- OpenAPI.Parameter.Context.Location
- OpenAPI.Parameter.SchemaContext
- OpenAPI.Parameter.SchemaContext.Style
- OpenAPI.Path
- OpenAPI.PathItem
- OpenAPI.PathItem.Endpoint
- OpenAPI.Request
- OpenAPI.Response
- OpenAPI.Response.StatusCode
- OpenAPI.Response.StatusCode.Range
- OpenAPI.RuntimeExpression
- OpenAPI.RuntimeExpression.Source
- OpenAPI.SecurityScheme
- OpenAPI.SecurityScheme.Location
- OpenAPI.SecurityScheme.SecurityType
- OpenAPI.SecurityScheme.SecurityType.Name
- OpenAPI.Server
- OpenAPI.Server.Variable
- OpenAPI.Tag
- OpenAPI.XML
- OrderedDictionary
- OrderedDictionary.Iterator
- ResolvedDocument
- ResolvedEndpoint
- ResolvedRoute
- URLTemplate
- URLTemplate.Component
- Validation
- ValidationContext
- ValidationError
- ValidationErrorCollection
- Validator
- Validator.CodingKey
Protocols
Global Functions
Extensions
- Array
- Bool
- Dictionary
- Double
- Float
- Int
- Int32
- Int64
- OpenAPI.Callbacks
- OpenAPI.Content.Encoding
- OpenAPI.Document.Info
- OpenAPI.Document.Info.Contact
- OpenAPI.Document.Info.License
- OpenAPI.Error.Decoding
- OpenAPI.Error.Decoding.Document
- OpenAPI.Error.Decoding.Operation
- OpenAPI.Error.Decoding.Path
- OpenAPI.Error.Decoding.Request
- OpenAPI.Error.Decoding.Response
- OpenAPI.OAuthFlows.AuthorizationCode
- OpenAPI.OAuthFlows.ClientCredentials
- OpenAPI.OAuthFlows.CommonFields
- OpenAPI.OAuthFlows.Implicit
- OpenAPI.OAuthFlows.Password
- OpenAPI.Parameter.Context
- OpenAPI.Parameter.SchemaContext
- OpenAPI.Response.StatusCode
- OpenAPI.Server.Variable
- Optional
- String
- URL
- UUID