Skip to content

DereferencedJSONSchema

mattpolzin edited this page Jul 3, 2020 · 5 revisions

DereferencedJSONSchema

A JSONSchema type that guarantees none of its nodes are references.

@dynamicMemberLookup public enum DereferencedJSONSchema

Inheritance

Equatable, JSONSchemaContext

Nested Type Aliases

Context

public typealias Context<Format: OpenAPIFormat> = JSONSchema.Context<Format>

NumericContext

public typealias NumericContext = JSONSchema.NumericContext

IntegerContext

public typealias IntegerContext = JSONSchema.IntegerContext

StringContext

public typealias StringContext = JSONSchema.StringContext

Initializers

init?(_:)

Create a DereferencedJSONSchema if possible.

internal init?(_ jsonSchema: JSONSchema)

If the JSONSchema passed to this initializer has any references this initializer will return nil.

Use the init(jsonSchema:resolvingIn:) initializer to resolve references to schemas in the Components Object when possible.

init(_:resolvingIn:)

Create a DereferencedJSONSchema if all references in the schema can be found in the given Components Object.

internal init(_ jsonSchema: JSONSchema, resolvingIn components: OpenAPI.Components) throws

Throws

ReferenceError.cannotLookupRemoteReference or MissingReferenceError.referenceMissingOnLookup(name:) 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.

Enumeration Cases

boolean

case boolean(: Context<JSONTypeFormat.BooleanFormat>)

object

case object(: Context<JSONTypeFormat.ObjectFormat>, : ObjectContext)

array

case array(: Context<JSONTypeFormat.ArrayFormat>, : ArrayContext)

number

case number(: Context<JSONTypeFormat.NumberFormat>, : NumericContext)

integer

case integer(: Context<JSONTypeFormat.IntegerFormat>, : IntegerContext)

string

case string(: Context<JSONTypeFormat.StringFormat>, : StringContext)

all

case all(of: [JSONSchemaFragment], discriminator: OpenAPI.Discriminator?)

one

case one(of: [DereferencedJSONSchema], discriminator: OpenAPI.Discriminator?)

any

case any(of: [DereferencedJSONSchema], discriminator: OpenAPI.Discriminator?)

not

case not(: DereferencedJSONSchema)

undefined

This schema does not have a type specified. This is allowed but does not offer much in the way of documenting the schema so it is represented here as "undefined" with an optional description.

case undefined(description: String?)

Properties

underlyingJSONSchema

Get the JSONSchema representation of this dereferenced schema.

var underlyingJSONSchema: JSONSchema

It is always possible to represent a DereferencedJSONSchema as a JSONSchema, although the reverse is not true.

required

var required: Bool

nullable

var nullable: Bool

title

var title: String?

description

var description: String?

discriminator

var discriminator: OpenAPI.Discriminator?

externalDocs

var externalDocs: OpenAPI.ExternalDocumentation?

allowedValues

var allowedValues: [AnyCodable]?

example

var example: AnyCodable?

readOnly

var readOnly: Bool

writeOnly

var writeOnly: Bool

deprecated

var deprecated: Bool

objectContext

Get the context specific to an object schema. If not an object schema, returns nil.

var objectContext: ObjectContext?

arrayContext

Get the context specific to an array schema. If not an array schema, returns nil.

var arrayContext: ArrayContext?
Types
Protocols
Global Functions
Extensions
Clone this wiki locally