Schema
/ API Reference / Validators
Schema
/ API Reference / Validators

isValidEnumSchema

A function that checks whether a given JSON schema is a valid JSON enum schema.

The Gist

import { isValidEnumSchema, T_JSONSchema } from '@weser/schema'

const schema: T_JSONSchema = {
  type: 'enum',
  enum: ['foo', 'bar'],
}

const isValid = isValidEnumSchema(schema)

Parameters

ParameterTypeDescription
schemaT_JSONSchemaThe JSON schema to check.

Returns

(boolean) Whether the schema is a valid JSON enum schema.

On this page