Skip to content

JSONSchema_CoreContext

mattpolzin edited this page Jun 11, 2021 · 4 revisions

JSONSchema.CoreContext

The context that applies to all schemas.

public struct CoreContext<Format: OpenAPIFormat>: JSONSchemaContext, Equatable 

Inheritance

Decodable, Encodable, Equatable, JSONSchemaContext

Initializers

init(format:required:nullable:permissions:deprecated:title:description:discriminator:externalDocs:allowedValues:defaultValue:example:)

public init(
            format: Format = .unspecified,
            required: Bool = true,
            nullable: Bool? = nil,
            permissions: Permissions? = nil,
            deprecated: Bool? = nil,
            title: String? = nil,
            description: String? = nil,
            discriminator: OpenAPI.Discriminator? = nil,
            externalDocs: OpenAPI.ExternalDocumentation? = nil,
            allowedValues: [AnyCodable]? = nil,
            defaultValue: AnyCodable? = nil,
            example: AnyCodable? = nil
        ) 

init(format:required:nullable:permissions:deprecated:title:description:discriminator:externalDocs:allowedValues:defaultValue:example:)

public init(
            format: Format = .unspecified,
            required: Bool = true,
            nullable: Bool? = nil,
            permissions: Permissions? = nil,
            deprecated: Bool? = nil,
            title: String? = nil,
            description: String? = nil,
            discriminator: OpenAPI.Discriminator? = nil,
            externalDocs: OpenAPI.ExternalDocumentation? = nil,
            allowedValues: [AnyCodable]? = nil,
            defaultValue: AnyCodable? = nil,
            example: String
        ) 

init(from:)

public init(from decoder: Decoder) throws 

Properties

format

public let format: Format

required

public let required: Bool 

title

public let title: String?

description

public let description: String?

externalDocs

public let externalDocs: OpenAPI.ExternalDocumentation?

discriminator

public let discriminator: OpenAPI.Discriminator?

allowedValues

public let allowedValues: [AnyCodable]?

defaultValue

public let defaultValue: AnyCodable?

example

public let example: AnyCodable?

nullable

public var nullable: Bool 

permissions

public var permissions: Permissions 

deprecated

public var deprecated: Bool 

formatString

public var formatString: String? 

readOnly

public var readOnly: Bool 

writeOnly

public var writeOnly: Bool 

isEmpty

public var isEmpty: Bool 

Methods

optionalContext()

Return the optional version of this Context

public func optionalContext() -> JSONSchema.CoreContext<Format> 

requiredContext()

Return the required version of this context

public func requiredContext() -> JSONSchema.CoreContext<Format> 

nullableContext()

Return the nullable version of this context

public func nullableContext() -> JSONSchema.CoreContext<Format> 

with(allowedValues:)

Return this context with the given list of possible values

public func with(allowedValues: [AnyCodable]) -> JSONSchema.CoreContext<Format> 

with(defaultValue:)

Return this context with the given default value.

public func with(defaultValue: AnyCodable) -> JSONSchema.CoreContext<Format> 

with(example:)

Return this context with the given example

public func with(example: AnyCodable) -> JSONSchema.CoreContext<Format> 

with(discriminator:)

Return this context with the given discriminator

public func with(discriminator: OpenAPI.Discriminator) -> JSONSchema.CoreContext<Format> 

encode(to:)

public func encode(to encoder: Encoder) throws 
Types
Protocols
Global Functions
Extensions
Clone this wiki locally