0015: Bounded value equality in a resolved data context
const restricts data to one value, and uniqueItems requires array elements to differ. RFC 9880 Appendix C defines those constraints at the information model level. It associates ordinary numbers, text, arrays, and maps with their JSON values, while Appendix C.2 and Section 4.7.1 give additional abstract meanings to format and sdfType. Equality must identify which of these meanings it established. This is an RFC interpretation for the supported ordinary-value scope, not an adoption of every JSON Schema rule.
Esdieff compares supplied conventional JSON values in an established shared effective data context. The result is equal, different, or undetermined, with its basis, available source identities and locations, and any operational or semantic limitation. The original JSON and numeric tokens remain available. Equality is separate from admission: equal values need not satisfy the effective type, null admission, bounds, format syntax, or other applicable constraints. No default is inserted, following ADR 0005: Nullability and presence.
Ordinary values
When the effective context establishes ordinary JSON value semantics without an additional meaning that could change equality:
- Null equals null. Booleans compare by their Boolean value. Different JSON value kinds differ; no string-to-number or Boolean-to-number coercion occurs.
- Numbers compare their exact mathematical decimal values using ADR 0012: Exact numbers and JSON input policies. For example,
10,10.0, and1e1are equal;-0equals0;0.1differs from0.10000000000000001;9007199254740992differs from9007199254740993. Integer versus number is a constraint distinction, not a second JSON number kind. A number capability failure does not justify equality even for identical retained tokens. - Text compares the decoded sequence of Unicode scalar values. JSON escape spelling is irrelevant. Case folding, Unicode normalization, and locale collation are absent:
"on"equals"\u006fn", while composed"é"differs from"e\u0301". - Arrays are ordered. Equal arrays have equal lengths and equal corresponding elements in their established item contexts.
[1,2]differs from[2,1];[10]equals[1e1]in an ordinary numeric item context. - Maps are unordered collections of decoded, case-sensitive string keys. Equal maps have the same key set and equal corresponding values in their established entry contexts. A missing entry differs from a present null entry. JSON member ordering has no equality meaning. Acceptance restriction A002 applies before usable map comparison at every depth, including opaque content; duplicate decoded keys do not choose a first or last value.
Compound equality requires every necessary comparison to establish equality. One definite difference establishes difference if unresolved information elsewhere cannot alter it. A different ordinary map key set or array length is decisive in an established ordinary structural context. An unavailable leaf does not erase an independent definite difference. If neither equality nor a decisive difference is established, the compound result is undetermined.
Additional meanings and unavailable contexts
A JSON representation comparison is a separately identified result. It cannot by itself establish that differing representations denote different abstract values. For example, differently offset date-time strings may denote the same instant, differently cased UUID text may name the same UUID, and alternative encodings may describe the same byte sequence. Meaning-specific comparators follow the separately adopted civil-time, resource and conventional JSON decisions; equality does not introduce additional normalization.
For a base format or sdfType, equality of supplied representations can establish abstract equality only when both operands’ denotations and a common compatible deterministic interpretation have been established. Recognizing a format name does not establish that interpretation or make an invalid or uninterpreted representation denote a value. Identical "not-a-date" strings therefore remain undetermined in a date-time context, even though their separately requested JSON representation comparison is equal. A meaningful interpretation may establish abstract equality without proving admission under all other constraints. Differing representations remain undetermined until an adopted meaning-specific comparator establishes equality or difference. Conventional byte-string and unix-time input remain those in ADR 0007: Generated SDF and sample JSON; those conventions alone do not provide all equality, representability, or normalization rules.
The comparison scope includes null in established compatible date, date-time, time, uri, uri-reference and uuid contexts. Null equals null; null and an established nonnull formatted value differ. An invalid nonnull representation, unavailable denotation, unknown equality-changing extension or incompatible alternative does not establish that difference. Null equality remains separate from admission, including when nullable:false excludes null. Restricted Direct meanings retain their existing boundaries. Null/null records no unperformed nonnull representation scan or knowledge query; mixed pairs retain the nonnull meaning actually established. Byte-string and Unix-time null handling follows the same separation.
Under ADR 0018: Civil date and time sample conventions, two established Gregorian dates compare by their calendar date. Equal decoded full-date text denotes the same date; different validated full-date text denotes different dates under the fixed-width convention. Both operands must establish denotation before a calendar conclusion, even when their text differs. JSON escape spelling is irrelevant. This adds no date ordering, epoch conversion, timezone or leap-knowledge requirement.
Two established dated date-times compare by their UTC instant. Numeric offsets adjust the Gregorian date and minute, exact fractional seconds ignore trailing zeros, and an inserted second retains its distinct slot. Offset annotations, letter case and JSON escape spelling do not distinguish instants; Z, +00:00 and -00:00 can therefore denote equal values under the recorded convention. Both denotations and a common compatible meaning are required before either equality or difference. Missing needed adjustment knowledge cannot supply a mismatch proof. This supplies no ordering, epoch coordinate, timezone database or date-free time comparator; differing nonnull time representations retain their unavailable comparison meaning.
Under that conventional channel, two established canonical byte strings compare by decoded JSON text, with complete canonical validation charged for each operand before comparison. Two established nonnegative POSIX coordinates compare by exact mathematical value, sharing the catalogue’s remaining numeric allowance. A malformed byte operand or unresolved negative POSIX denotation prevents abstract equality, including identical tokens. One established operand can supply truthful partial abstract support while the pair remains undetermined. Different conventional JSON domains may exclude a potential alternative only when its established context proves that exclusion; an unknown potentially matching alternative remains relevant.
Each pair carries its own supporting references and actual limitations. Const and enum reduction preserve only the decisive complete witness or necessary universal-exclusion proof. An earlier unknown or rejected enum candidate cannot leave limitations or discarded proof after a later definite match. Request consultation remains cumulative across these attempts. Unknown potentially matching candidates prevent an unjustified universal rejection without erasing independent established areas.
A decisive compound difference retains its actual leaf or structural rule and the established enclosing arrays and maps on that path. Completed siblings do not supply that proof, even if they established another ordinary or abstract meaning. Equal and undetermined pairs retain their complete or partial aggregate support. Independent abstract-value assessment and request consultation remain visible separately from the decisive const proof.
RFC 9880 Section 4.7.2 gives choices inherited qualities and explicit overrides, with alternatives that can overlap. Choice admission does not select an equality interpretation. Neither alternative ordering nor a first successful admission result establishes a common meaning for two operands. When alternatives introduce incompatible or unresolved interpretations, affected equality remains undetermined unless the library can establish a common compatible interpretation for both values. It may retain surrounding ordinary map or array structure and independent siblings where that meaning is unaffected. An equality consumer must not select whichever alternative produces its preferred verdict.
An unknown critical feature, unresolved effective context, unknown equality-changing extension, or unsupported abstract meaning gives undetermined for affected comparisons, including identical input when its common interpretation cannot be established. Established surrounding ordinary structure can still supply independent differences. Unsupported decoded string values remain scoped unavailable according to ADR 0012; unsupported decoded keys can prevent usable map construction. The library derives the resolved context from the effective description. Callers do not rebuild reference, item, property, choice, or extension meaning from generic JSON maps, following ADR 0010: Domain-oriented library and caller simplicity.
Known data-description roles remain distinct. In particular, the restricted items vocabulary in RFC 9880 Appendix A does not turn framework-admitted wider direct-item content into an ordinary full data description. A needed unsupported item interpretation remains undetermined. Appendix A permits items independently of an optional type. When items is present but context derivation has not established its applicable array structure, comparison remains undetermined instead of discarding the item meaning. Thus identical ["not-a-date"] representations under {"items":{"format":"date-time"}} do not establish abstract equality.
Object property meaning likewise requires an established applicable object structure: Appendix A’s compound-type requires type: "object". In full descriptions and restricted direct-item descriptions, properties without an established object structure gives an unavailable context instead of being discarded as an annotation. For example, identical [{"stamp":"not-a-date"}] values under {"type":"array","items":{"properties":{"stamp":{"format":"date-time"}}}} remain undetermined. With an established object structure, object-item properties contain full descriptions, so ordinary nested structure there can be compared in its established context. These guards preserve independently definite differences in surrounding ordinary siblings. Unknown qualities are retained with their source and are never guessed to be harmless equality annotations.
Null equality and primitive representation comparison are not a substitute for the chosen alternative’s null and type constraints. A format or sdfType is never ignored just because a string or number can be decoded. Unknown alternatives do not become a definite const rejection solely because one representation differs.
Finite work and constraint consumers
Comparison shares request-wide finite numeric, decoding, structural comparison, pair-count, parsed-node, and location-materialization budgets. Input size, container depth, per-source node count, numerical coefficient and exponent capability remain those in ADR 0012. Work is charged before traversal, string/key comparison, exact numeric comparison, repeated pair comparisons, or derived pointer allocation; arithmetic remains checked. Production ancestry is compact or shared, and pointers are materialized only as needed within finite budgets. Raising one budget does not silently remove another bound. A semantic-work or required-location-handle capability limit leaves the affected conclusion undetermined. Available source identities and spans remain usable when a rendered pointer cannot be materialized. Pointer presentation omission preserves the established verdict and is reported separately, following ADR 0009: Bounded processing and reporting.
A scalar or compound const comparison uses this one equality contract: equal establishes the equality part of matching, different establishes a mismatch only on its stated semantic basis, and undetermined leaves that part incomplete. Other constraints continue to contribute their independent results.
For uniqueItems: true, one established equal pair disproves uniqueness. All required pairs established different prove uniqueness. An undetermined necessary pair prevents a positive uniqueness conclusion unless another equal pair independently disproves uniqueness. Exhausting pair or comparison work is undetermined, never evidence that items differ. An empty or singleton array is vacuously unique without comparing values; decoding, item checks, and other constraints remain separate. False or absent uniqueItems requires no uniqueness comparison. A consumer may use indexing or fingerprints for candidate selection, but those cannot replace exact equality or introduce a different semantic policy.
Initial comparison investigation defaults retain ADR 0012 and align with the shared workflow defaults in ADR 0013: Shared workflow and report guarantees: 500,000 parsed nodes per request, 10,000,000 shared context/structural/string/key work units, 8 KiB per rendered pointer and 8 MiB cumulative pointer presentation output/work. Numeric work retains 2,000,000 units. Comparison-specific additional caps are 32 MiB of decoding work and 100,000 operand-pair comparisons per request. Nonzero finite configuration and supported stack limits are validated before work; these are implementation capability, not RFC limits or a performance claim. Product implementations may improve algorithms while keeping the same three-result semantics and supplying bounded evidence for changed finite-work accounting.
Considered Options
Raw-text equality would incorrectly distinguish escape spellings, numeric notation, and map member ordering. Machine floats or default numeric JSON decoding could silently merge distinct numbers before a const or uniqueness conclusion. Unconditional deep JSON equality would invent abstract meaning for formats and sdfType; treating every different representation as an unknown would unnecessarily defer ordinary scalar and compound constraints. Normalizing dates, URIs, UUIDs, or byte strings here would settle separate semantic decisions without their evidence. Keeping equality logic in each constraint consumer would allow const and uniqueness to disagree. Unlimited pairwise work or ancestor-pointer copying would violate the finite-work contract.