@samatawy/checks
    Preparing search index...

    Class SchemaCheck

    Builds an ObjectCheck from a standard JSON Schema object or JSON file path.

    Current support is intentionally limited to a reviewable subset of JSON Schema:

    • root object schemas
    • type, properties, required, additionalProperties: false
    • items, minItems, maxItems
    • minLength, maxLength, pattern, format, enum, const
    • minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf

    The class currently does not implement reference or conditional features such as $ref, if/then/else, tuple arrays, or pattern-based property schemas.

    Index

    Constructors

    Methods

    • Creates a SchemaCheck instance from a JSON Schema file path.

      Parameters

      • filePath: string

        The file path to the JSON Schema.

      Returns SchemaCheck

      A new instance of SchemaCheck.

    • Performs a check against the provided input using the schema.

      Parameters

      • input: unknown

        The input value to be validated against the schema.

      Returns Promise<ObjectCheck>

      A promise that resolves to an ObjectCheck instance.

    • Shorthand for performing a check and immediately retrieving the result, useful for simple validations or testing.

      Parameters

      • input: unknown

        The input value to be validated against the schema.

      • Optionaloptions: ResultOptions

        Optional result options to customize the validation result.

      Returns Promise<IResult>

      A promise that resolves to the validation result.