-
Notifications
You must be signed in to change notification settings - Fork 43
OpenAPI_Content
OpenAPI Spec "Media Type Object"
public struct Content: Equatable, CodableVendorExtendable
See OpenAPI Media Type Object.
CodableVendorExtendable
, Decodable
, Encodable
, Equatable
, LocallyDereferenceable
public typealias Map = OrderedDictionary<OpenAPI.ContentType, OpenAPI.Content>
Create Content
with a schema, a reference to a schema, or no
schema at all and optionally provide a single example.
public init(schema: Either<JSONReference<JSONSchema>, JSONSchema>?, example: AnyCodable? = nil, encoding: OrderedDictionary<String, Encoding>? = nil, vendorExtensions: [String: AnyCodable] = [:])
Create Content
with a reference to a schema and optionally
provide a single example.
public init(schemaReference: JSONReference<JSONSchema>, example: AnyCodable? = nil, encoding: OrderedDictionary<String, Encoding>? = nil, vendorExtensions: [String: AnyCodable] = [:])
Create Content
with a schema and optionally provide a single
example.
public init(schema: JSONSchema, example: AnyCodable? = nil, encoding: OrderedDictionary<String, Encoding>? = nil, vendorExtensions: [String: AnyCodable] = [:])
Create Content
with a schema, a reference to a schema, or no
schema at all and optionally provide a map of examples.
public init(schema: Either<JSONReference<JSONSchema>, JSONSchema>?, examples: Example.Map?, encoding: OrderedDictionary<String, Encoding>? = nil, vendorExtensions: [String: AnyCodable] = [:])
Create Content
with a reference to a schema and optionally
provide a map of examples.
public init(schemaReference: JSONReference<JSONSchema>, examples: Example.Map?, encoding: OrderedDictionary<String, Encoding>? = nil, vendorExtensions: [String: AnyCodable] = [:])
Create Content
with a schema and optionally provide a map
of examples.
public init(schema: JSONSchema, examples: Example.Map?, encoding: OrderedDictionary<String, Encoding>? = nil, vendorExtensions: [String: AnyCodable] = [:])
public init(from decoder: Decoder) throws
var schema: Either<JSONReference<JSONSchema>, JSONSchema>?
var example: AnyCodable?
var examples: Example.Map?
var encoding: OrderedDictionary<String, Encoding>?
Dictionary of vendor extensions.
var vendorExtensions: [String: AnyCodable]
These should be of the form:
[ "x-extensionKey": <anything>]
where the values are anything codable.
Pulls the first (inlined, not referenced) example found in the example dictionary given.
internal static func firstExample(from exampleDict: OpenAPI.Example.Map) -> AnyCodable?
Operates on a dictionary with values that may be either an Example or a reference to and example.
Pulls the first example found in the example dictionary given.
internal static func firstExample(from exampleDict: OrderedDictionary<String, OpenAPI.Example>) -> AnyCodable?
public func encode(to encoder: Encoder) throws
Create a DereferencedContent
if all references in the
content can be found in the given Components Object.
public func dereferenced(in components: OpenAPI.Components) throws -> DereferencedContent
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.
.
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