Skip to content

JSONSchema_CoreContext

mattpolzin edited this page Sep 28, 2020 · 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: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, 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? = nil, permissions: Permissions? = nil, deprecated: Bool? = nil, 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?

nullable

var nullable: Bool

permissions

var permissions: Permissions

deprecated

var deprecated: Bool

formatString

var formatString: String?

readOnly

var readOnly: Bool

writeOnly

var writeOnly: Bool

isEmpty

var isEmpty: Bool

Methods

combined(with:)

internal func combined(with other: Self) throws -> Self

validatedContext()

internal func validatedContext<NewFormat: OpenAPIFormat>() throws -> JSONSchema.CoreContext<NewFormat>

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