FHIRInstantiationContext

public struct FHIRInstantiationContext

Holds context during instantiation.

  • Whether validation errors should be thrown.

    Declaration

    Swift

    public var strict: Bool
  • A set of keys found and handled in the JSON.

    Declaration

    Swift

    public internal(set) var presentKeys = Set<String>()
  • Validation errors that occurred.

    Declaration

    Swift

    public internal(set) var errors = [FHIRValidationError]()
  • Designated initializer.

    Declaration

    Swift

    public init(strict: Bool = true)
  • Return a fresh context, retaining all relevant settings but not keys and errors, to be used on sub-items.

    Declaration

    Swift

    public func fresh() -> FHIRInstantiationContext
  • Adds the given key to presentKeys.

    Declaration

    Swift

    public mutating func insertKey(_ key: String)
  • Checks whether the given key is already present.

    Declaration

    Swift

    public func containsKey(_ key: String) -> Bool
  • Update the receiver with information from a sub-context.

    Declaration

    Swift

    public mutating func consume(_ context: FHIRInstantiationContext)
  • Pass all keys that were present so the receiver can determine superfluuous properties.

    Declaration

    Swift

    public mutating func finalize(for json: FHIRJSON)

    Parameters

    json

    The JSON that was used during initialization

  • Call to either throw or log validation errors, if any.

    Declaration

    Swift

    public func validate() throws