@metreeca/blue - v0.12.0
    Preparing search index...

    Type Alias NumberShape<V>

    NumberShape: NumberConstraints<V> & { kind: "number" }

    Describes a numeric value.

    Admits the JSON numbers a resource may carry, bounded by range and enumeration constraints and typed as an XSD 1.0 numeric datatype, so that a validated value carries the datatype the shape states rather than the one JSON leaves unsaid.

    Inheritance

    Where a resource!ResourceShape extends the shapes it lists as parents, numeric-valued members are merged according to the following rules. The child is the extending shape; the parent is the inherited one.

    Field Override Rule
    kind Cannot be overridden
    datatype Must be strictly equal when both defined; the single defined value carries through
    integral Child may add but not drop; an inherited constraint always carries through
    minExclusive Child may only raise the exclusive lower bound
    maxExclusive Child may only lower the exclusive upper bound
    minInclusive Child may only raise the inclusive lower bound
    maxInclusive Child may only lower the inclusive upper bound
    in Child may only drop allowed values
    hasValue Child may only add required values

    Inclusive/exclusive pairs are independently merged: a child may define an exclusive bound alongside a parent's inclusive bound (or vice versa), narrowing the range without removing the original constraint.

    Cross-field validation

    • merged minExclusive must be < merged maxExclusive
    • merged minInclusive must be ≤ merged maxInclusive
    • exclusive and inclusive bounds must not contradict
    • all merged hasValue entries must be members of the merged in set (if defined)

    Type Parameters

    • V extends number = number

      The values the shape admits, narrowed to the enumerated ones where it states an enumeration and the whole numeric domain otherwise

    Type Declaration

    • Readonlykind: "number"

      Discriminator identifying this as a number shape.

      Inheritance — cannot be overridden.