Skip to content

JSONSchema_Context

mattpolzin edited this page Jul 3, 2020 · 3 revisions

JSONSchema.Context

The context that applies to all schemas.

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

Inheritance

Decodable, Encodable, Equatable, JSONSchemaContext

Initializers

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

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

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

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

init(from:)

public init(from decoder: Decoder) throws

Properties

format

let format: Format

required

let required: Bool

nullable

let nullable: Bool

permissions

let permissions: Permissions

deprecated

let deprecated: Bool

title

let title: String?

description

let description: String?

externalDocs

let externalDocs: OpenAPI.ExternalDocumentation?

discriminator

let discriminator: OpenAPI.Discriminator?

allowedValues

let allowedValues: [AnyCodable]?

example

let example: AnyCodable?

readOnly

var readOnly: Bool

writeOnly

var writeOnly: Bool

Methods

optionalContext()

Return the optional version of this Context

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

requiredContext()

Return the required version of this context

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

nullableContext()

Return the nullable version of this context

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

with(allowedValues:)

Return this context with the given list of possible values

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

with(example:)

Return this context with the given example

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

encode(to:)

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