necoherence/semantic_validation

Types

pub type DefaultApplication {
  DefaultApplication(
    value_path: List(semantic_types.PathStep),
    type_ref: semantic_types.TypeRef,
    origin: semantic_types.OccurrenceRef,
    value: exact_json.JsonValue,
  )
}

Constructors

pub opaque type DefaultedValue
pub type MemberProof {
  MemberProof(children: List(MemberProof))
}

Constructors

pub type ProjectionAssumption {
  Present(path: List(semantic_types.PathStep))
  NonNull(path: List(semantic_types.PathStep))
  Variant(path: List(semantic_types.PathStep), tag: String)
  IndexPresent(path: List(semantic_types.PathStep), index: Int)
}

Constructors

pub type ProjectionCertificate {
  ProjectionCertificate(
    profile: semantic_types.ProfileRef,
    source_refs: List(semantic_types.SourceRef),
    source: semantic_types.SlotContract,
    path: List(semantic_types.PathStep),
    assumptions: List(ProjectionAssumption),
    destination: semantic_types.SlotContract,
  )
}

Constructors

pub type ProjectionFailure {
  WrongShape(
    type_ref: semantic_types.TypeRef,
    path: List(semantic_types.PathStep),
  )
  MissingField(type_ref: semantic_types.TypeRef, name: String)
  MissingVariant(type_ref: semantic_types.TypeRef, tag: String)
  BranchAssumptionRequired(
    path: List(semantic_types.PathStep),
    tag: String,
  )
  ProjectionUnresolved(
    obligations: List(semantic_types.SemanticObligation),
  )
  CertificateMismatch(condition: String)
}

Constructors

pub type ProjectionValueFailure {
  Projection(failure: ProjectionFailure)
  Validation(failure: ValidationFailure)
  UnsatisfiedGuard
}

Constructors

pub opaque type ValidatedSlot
pub opaque type ValidatedValue
pub type ValidationFailure {
  Rejected(failure: semantic_types.ValueFailure)
  Unresolved(
    obligations: List(semantic_types.SemanticObligation),
  )
  CertificateMismatchFailure(condition: String)
}

Constructors

Values

pub fn accepts_value(
  graph: semantic_types.SemanticGraph,
  reference: semantic_types.TypeRef,
  value: exact_json.JsonValue,
) -> Bool
pub fn assumption_holds(
  tag: option.Option(semantic_types.TagModel),
  value: exact_json.JsonValue,
  assumption: ProjectionAssumption,
) -> Bool
pub fn check_default_applications(
  graph: semantic_types.SemanticGraph,
  before: exact_json.JsonValue,
  after: exact_json.JsonValue,
  applications: List(DefaultApplication),
) -> Bool
pub fn check_meaning_defined(
  graph: semantic_types.SemanticGraph,
  references: List(semantic_types.TypeRef),
) -> Result(Nil, semantic_types.MeaningFailure)
pub fn check_member_certificate(
  graph: semantic_types.SemanticGraph,
  reference: semantic_types.TypeRef,
  value: exact_json.JsonValue,
  proof: MemberProof,
) -> Result(Nil, ValidationFailure)
pub fn check_projection_certificate(
  graph: semantic_types.SemanticGraph,
  certificate: ProjectionCertificate,
) -> Result(Nil, ProjectionFailure)
pub fn defaulted_value(
  value: DefaultedValue,
) -> exact_json.JsonValue
pub fn defaulted_value_applications(
  value: DefaultedValue,
) -> List(DefaultApplication)
pub fn defaulted_value_graph(
  value: DefaultedValue,
) -> semantic_types.SemanticGraph
pub fn defaulted_value_type_ref(
  value: DefaultedValue,
) -> semantic_types.TypeRef
pub fn element_allows_null(
  graph: semantic_types.SemanticGraph,
  contract: semantic_types.ElementContract,
) -> Bool
pub fn grapheme_boundaries(
  rules: semantic_types.GraphemeRules,
  text: String,
) -> List(Int)
pub fn grapheme_count(
  rules: semantic_types.GraphemeRules,
  text: String,
) -> Int
pub fn recognizes(
  rule: semantic_types.FormatRule,
  text: String,
) -> Bool
pub fn validated_slot_contract(
  value: ValidatedSlot,
) -> semantic_types.SlotContract
pub fn validated_slot_graph(
  value: ValidatedSlot,
) -> semantic_types.SemanticGraph
pub fn validated_value(
  value: ValidatedValue,
) -> exact_json.JsonValue
pub fn validated_value_graph(
  value: ValidatedValue,
) -> semantic_types.SemanticGraph
pub fn validated_value_proof(
  value: ValidatedValue,
) -> MemberProof
pub fn validated_value_type_ref(
  value: ValidatedValue,
) -> semantic_types.TypeRef
pub fn wrapper_payload_text(
  profile: semantic_types.SemanticProfile,
  wrapper: semantic_types.Wrapper,
  value: exact_json.JsonValue,
) -> Result(String, semantic_types.ValueCondition)
✨ Search Document