Skip to content

OpenAPI_Content

mattpolzin edited this page Aug 21, 2023 · 9 revisions

OpenAPI.Content

OpenAPI Spec "Media Type Object"

public struct Content: Equatable, CodableVendorExtendable 

See OpenAPI Media Type Object.

Inheritance

CodableVendorExtendable, Decodable, Encodable, Equatable, LocallyDereferenceable

Nested Type Aliases

Map

public typealias Map = OrderedDictionary<OpenAPI.ContentType, OpenAPI.Content>

Initializers

init(schema:example:encoding:vendorExtensions:)

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] = [:]
        ) 

init(schemaReference:example:encoding:vendorExtensions:)

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] = [:]
        ) 

init(schema:example:encoding:vendorExtensions:)

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] = [:]
        ) 

init(schema:examples:encoding:vendorExtensions:)

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] = [:]
        ) 

init(schemaReference:examples:encoding:vendorExtensions:)

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] = [:]
        ) 

init(schema:examples:encoding:vendorExtensions:)

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] = [:]
        ) 

init(from:)

public init(from decoder: Decoder) throws 

Properties

schema

public var schema: Either<JSONReference<JSONSchema>, JSONSchema>?

example

public var example: AnyCodable?

examples

public var examples: Example.Map?

encoding

public var encoding: OrderedDictionary<String, Encoding>?

vendorExtensions

Dictionary of vendor extensions.

public var vendorExtensions: [String: AnyCodable]

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

Methods

encode(to:)

public func encode(to encoder: Encoder) throws 

_dereferenced(in:following:dereferencedFromComponentNamed:)

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 -> DereferencedContent 

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.

Types
Protocols
Global Functions
Extensions
Clone this wiki locally