schema-components - v3.7.0
    Preparing search index...

    Function mergeAllOf

    • Merge multiple JSON Schema objects from allOf into one. Merges: properties, required, meta fields, and constraints.

      Semantics are first-write-wins for meta and constraint keywords. When a later branch redefines a keyword with a non-equal value the later value is silently dropped — an allof-conflict diagnostic is emitted so the loss is visible to consumers.

      Boolean branches (valid per Draft 06+) collapse the composite:

      • false makes the entire allOf unsatisfiable — return false, which the walker turns into a NeverField.
      • true is the always-valid schema and contributes no constraints — skip silently.

      Type compatibility is enforced rather than papered over: two branches asserting incompatible primitive type keywords (e.g. stringnumber) describe an unsatisfiable conjunction. mergeAllOf returns false and emits schema-allof-incompatible so the walker produces the same NeverField shape it gives a top-level false schema. Pretending the first type wins silently would silently weaken the constraint for any consumer that reads the merged result.

      Non-boolean, non-object entries (e.g. arrays, numbers) are malformed inputs that cannot represent a schema; skip them as before.

      Parameters

      Returns false | Record<string, unknown>