This guide compares @samatawy/checks with the JSON Schema standard.
The short version is:
@samatawy/checks overlaps with many common validation tasks expressed in JSON SchemaSchemaCheck, but it does not emit or fully model the standardUse JSON Schema when you need standards-based interoperability. Use @samatawy/checks when you want fluent rules, async validation, decorator-based models, result catalogs, or validated runtime output.
SchemaCheck can ingest either a schema object or a JSON schema file path and map the supported subset into the fluent validation API. That is useful for application-owned schemas, but it is still intentionally narrower than full JSON Schema tooling.
These JSON Schema-style concerns map well to the package:
ObjectCheckcheckEach(...)noExtraFields()Examples of rough equivalents:
type: object maps to object() or ObjectCheck.for(...)required maps to required(name)minLength and maxLength map to string checks of the same intentpattern maps to string().pattern(...)enum maps roughly to string().equalsOneOf(...) or similar value checksminimum and maximum map roughly to atLeast(...) and atMost(...)additionalProperties: false maps roughly to noExtraFields()allOf, anyOf, oneOf, and not map roughly to fluent composition helpers such as ObjectCheck.allOf(...), ObjectCheck.anyOf(...), ObjectCheck.oneOf(...), and ObjectCheck.not(...)In several areas, @samatawy/checks is more application-focused than JSON Schema:
isTrue(...) and isTrueEach(...)file() and image()validated: 'partial' | 'strict' can return a filtered runtime clone of the inputObjectFactory can validate and then hydrate class instancesThese features are especially useful for server-side business validation, ingestion pipelines, and rich UI workflows where messages and filtered output matter as much as pass or fail.
The package does not cover the full JSON Schema standard.
Notable gaps include:
SchemaCheck.from(...) and SchemaCheck.fromFile(...)$schema, $id, $defs, or $refif / then / elsedependentRequired or dependentSchemaspatternProperties, propertyNames, or unevaluatedPropertiesprefixItemsunevaluatedItems support for array items left over after other item rulestitle, description, default, examples, readOnly, or writeOnlyFor clarity on the array-specific keywords:
contains means at least one array item must match a nested schemaminContains and maxContains refine that by constraining how many items may matchprefixItems is for tuple-style arrays where each position has its own schemaunevaluatedItems governs leftover items that were not already consumed by other array keywordsSchemaCheck now supports contains, minContains, and maxContains within its supported array subset.
prefixItems and unevaluatedItems are still valid JSON Schema concepts that SchemaCheck currently rejects rather than attempting a partial translation into the fluent API.
Current limitation of the composition support:
SchemaCheck now supports allOf, anyOf, oneOf, and not within the current supported subset, including object schemas, field schemas, array schemas, and array item schemasSchemaCheck also supports common core keywords such as type, properties, required, additionalProperties: false, items, string constraints, numeric constraints, enum, and constSo while the package can express many of the same rules, it does not provide standards interoperability.
If the question is “can this package validate many of the same things I would normally validate with JSON Schema?”, the answer is yes.
If the question is “does this package implement JSON Schema as a standard?”, the answer is no.
A useful rule of thumb is:
@samatawy/checks when validation lives inside your TypeScript application and you want richer runtime behaviorChoose JSON Schema when you need:
Choose @samatawy/checks when you need: