본문으로 건너뛰기

isNullableArraySchema

Determines whether a given JSON schema represents a nullable array type. Validates that the schema's type property is an array containing both 'array' and 'null', indicating it describes nullable array values.

Signature

const isNullableArraySchema: (schema: UnknownSchema) => schema is NullableArraySchema

Parameters

NameTypeDescription
schema-The JSON schema object to inspect

Returns

Type-safe boolean indicating whether the schema is a NullableArraySchema

Examples

Example 1

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

Playground

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