Skip to main content

isNonNullableArraySchema

Determines whether a given JSON schema represents a non-nullable array type. Validates that the schema's type property is set to 'array' (not an array of types), indicating it describes non-nullable array values.

Signature

const isNonNullableArraySchema: (schema: UnknownSchema) => schema is NonNullableArraySchema

Parameters

NameTypeDescription
schema-The JSON schema object to inspect

Returns

Type-safe boolean indicating whether the schema is a non-nullable ArraySchema

Examples

Example 1

isNonNullableArraySchema({ type: 'array', items: { type: 'string' } }); // true
isNonNullableArraySchema({ type: ['array', 'null'] }); // false
isNonNullableArraySchema({ type: 'object' }); // false

Playground

isNonNullableArraySchema({ type: 'array', items: { type: 'string' } }); // true
isNonNullableArraySchema({ type: ['array', 'null'] }); // false
isNonNullableArraySchema({ type: 'object' }); // false