-
Notifications
You must be signed in to change notification settings - Fork 37
DereferencedJSONSchema
A JSONSchema
type that guarantees none of its
nodes are references.
@dynamicMemberLookup
public enum DereferencedJSONSchema: Equatable, JSONSchemaContext
Equatable
, JSONSchemaContext
public typealias CoreContext<Format: OpenAPIFormat> = JSONSchema.CoreContext<Format>
public typealias NumericContext = JSONSchema.NumericContext
public typealias IntegerContext = JSONSchema.IntegerContext
public typealias StringContext = JSONSchema.StringContext
case boolean(CoreContext<JSONTypeFormat.BooleanFormat>)
case number(CoreContext<JSONTypeFormat.NumberFormat>, NumericContext)
case integer(CoreContext<JSONTypeFormat.IntegerFormat>, IntegerContext)
case string(CoreContext<JSONTypeFormat.StringFormat>, StringContext)
indirect case object(CoreContext<JSONTypeFormat.ObjectFormat>, ObjectContext)
indirect case array(CoreContext<JSONTypeFormat.ArrayFormat>, ArrayContext)
indirect case all(of: [DereferencedJSONSchema], core: CoreContext<JSONTypeFormat.AnyFormat>)
indirect case one(of: [DereferencedJSONSchema], core: CoreContext<JSONTypeFormat.AnyFormat>)
indirect case any(of: [DereferencedJSONSchema], core: CoreContext<JSONTypeFormat.AnyFormat>)
indirect case not(DereferencedJSONSchema, core: CoreContext<JSONTypeFormat.AnyFormat>)
Schemas without a type
.
case fragment(CoreContext<JSONTypeFormat.AnyFormat>)
Get the JSONSchema representation of this dereferenced schema.
public var jsonSchema: JSONSchema
This will not necessarily be the same schema that was used to create this dereferenced schema if there was one.
It is always possible to represent a
DereferencedJSONSchema
as a
JSONSchema
, although the reverse is
not true.
public var formatString: String?
public var required: Bool
public var nullable: Bool
public var title: String?
public var description: String?
public var discriminator: OpenAPI.Discriminator?
public var externalDocs: OpenAPI.ExternalDocumentation?
public var allowedValues: [AnyCodable]?
public var defaultValue: AnyCodable?
public var example: AnyCodable?
public var readOnly: Bool
public var writeOnly: Bool
public var deprecated: Bool
Get the context specific to an object
schema. If not an
object schema, returns nil
.
public var objectContext: ObjectContext?
Get the context specific to an array
schema. If not an
array schema, returns nil
.
public var arrayContext: ArrayContext?
Get a simplified DereferencedJSONSchema
.
public func simplified() throws -> DereferencedJSONSchema
A fully simplified JSON Schema is both dereferenced and also reduced to a more normal form where possible.
As an example, many compound schemas can be simplified.
{
"allOf": [
{ "type": "object", "description": "Hello World" },
{
"properties": [
"name": { "type": "string" }
]
}
]
}
simplifies to ->
{
"type": "object",
"description": "Hello World",
"properties": [
"name": { "type": "string" }
]
}
You can create simplified schemas from the DereferencedJSONSchema
type with the simplified()
method or you can create simplified schemas from
the JSONSchema
type with the simplified(given:)
method (which
combines dereferencing and resolving by taking the OpenAPI.Components
as
input).
.
Types
- AnyCodable
- DereferencedContent
- DereferencedContentEncoding
- DereferencedDocument
- DereferencedDocument.Route
- DereferencedHeader
- DereferencedJSONSchema
- DereferencedJSONSchema.ArrayContext
- DereferencedJSONSchema.ObjectContext
- DereferencedOperation
- DereferencedOperation.ResponseOutcome
- DereferencedParameter
- DereferencedPathItem
- DereferencedPathItem.Endpoint
- DereferencedRequest
- DereferencedResponse
- DereferencedSchemaContext
- DereferencedSecurityRequirement
- DereferencedSecurityRequirement.ScopedScheme
- Either
- EitherDecodeNoTypesMatchedError
- EitherDecodeNoTypesMatchedError.IndividualFailure
- ErrorCategory
- ErrorCategory.KeyValue
- InconsistencyError
- JSONReference
- JSONReference.InternalReference
- JSONReference.Path
- JSONReference.PathComponent
- JSONSchema
- JSONSchema.ArrayContext
- JSONSchema.CoreContext
- JSONSchema.CoreContext.Permissions
- JSONSchema.IntegerContext
- JSONSchema.IntegerContext.Bound
- JSONSchema.NumericContext
- JSONSchema.NumericContext.Bound
- JSONSchema.ObjectContext
- JSONSchema.StringContext
- JSONSchemaResolutionError
- JSONType
- JSONTypeFormat
- JSONTypeFormat.AnyFormat
- JSONTypeFormat.ArrayFormat
- JSONTypeFormat.BooleanFormat
- JSONTypeFormat.IntegerFormat
- JSONTypeFormat.IntegerFormat.Extended
- JSONTypeFormat.NumberFormat
- JSONTypeFormat.ObjectFormat
- JSONTypeFormat.StringFormat
- JSONTypeFormat.StringFormat.Extended
- OpenAPI
- OpenAPI.CallbackURL
- OpenAPI.ComponentKey
- OpenAPI.Components
- OpenAPI.Components.ReferenceCycleError
- OpenAPI.Components.ReferenceError
- OpenAPI.Content
- OpenAPI.Content.Encoding
- OpenAPI.ContentType
- OpenAPI.Discriminator
- OpenAPI.Document
- OpenAPI.Document.Info
- OpenAPI.Document.Info.Contact
- OpenAPI.Document.Info.License
- OpenAPI.Document.Route
- OpenAPI.Document.Version
- OpenAPI.Error
- OpenAPI.Error.Decoding
- OpenAPI.Error.Decoding.Document
- OpenAPI.Error.Decoding.Document.Context
- OpenAPI.Error.Decoding.Operation
- OpenAPI.Error.Decoding.Operation.Context
- OpenAPI.Error.Decoding.Path
- OpenAPI.Error.Decoding.Path.Context
- OpenAPI.Error.Decoding.Request
- OpenAPI.Error.Decoding.Request.Context
- OpenAPI.Error.Decoding.Response
- OpenAPI.Error.Decoding.Response.Context
- OpenAPI.Example
- OpenAPI.ExternalDocumentation
- OpenAPI.Header
- OpenAPI.HttpMethod
- OpenAPI.Link
- OpenAPI.OAuthFlows
- OpenAPI.OAuthFlows.AuthorizationCode
- OpenAPI.OAuthFlows.ClientCredentials
- OpenAPI.OAuthFlows.CommonFields
- OpenAPI.OAuthFlows.Implicit
- OpenAPI.OAuthFlows.Password
- OpenAPI.Operation
- OpenAPI.Operation.ResponseOutcome
- OpenAPI.Parameter
- OpenAPI.Parameter.Context
- OpenAPI.Parameter.Context.Location
- OpenAPI.Parameter.SchemaContext
- OpenAPI.Parameter.SchemaContext.Style
- OpenAPI.Path
- OpenAPI.PathItem
- OpenAPI.PathItem.Endpoint
- OpenAPI.Request
- OpenAPI.Response
- OpenAPI.Response.StatusCode
- OpenAPI.Response.StatusCode.Range
- OpenAPI.RuntimeExpression
- OpenAPI.RuntimeExpression.Source
- OpenAPI.SecurityScheme
- OpenAPI.SecurityScheme.Location
- OpenAPI.SecurityScheme.SecurityType
- OpenAPI.SecurityScheme.SecurityType.Name
- OpenAPI.Server
- OpenAPI.Server.Variable
- OpenAPI.Tag
- OpenAPI.XML
- OrderedDictionary
- OrderedDictionary.Iterator
- ResolvedDocument
- ResolvedEndpoint
- ResolvedRoute
- URLTemplate
- URLTemplate.Component
- Validation
- ValidationContext
- ValidationError
- ValidationErrorCollection
- Validator
- Validator.CodingKey
Protocols
Global Functions
Extensions
- Array
- Bool
- Dictionary
- Double
- Float
- Int
- Int32
- Int64
- OpenAPI.Callbacks
- OpenAPI.Content.Encoding
- OpenAPI.Document.Info
- OpenAPI.Document.Info.Contact
- OpenAPI.Document.Info.License
- OpenAPI.Error.Decoding
- OpenAPI.Error.Decoding.Document
- OpenAPI.Error.Decoding.Operation
- OpenAPI.Error.Decoding.Path
- OpenAPI.Error.Decoding.Request
- OpenAPI.Error.Decoding.Response
- OpenAPI.OAuthFlows.AuthorizationCode
- OpenAPI.OAuthFlows.ClientCredentials
- OpenAPI.OAuthFlows.CommonFields
- OpenAPI.OAuthFlows.Implicit
- OpenAPI.OAuthFlows.Password
- OpenAPI.Parameter.Context
- OpenAPI.Parameter.SchemaContext
- OpenAPI.Response.StatusCode
- OpenAPI.Server.Variable
- Optional
- String
- URL
- UUID