Schema
/ API Reference / Guards
Schema
/ API Reference / Guards

isEnumSchema

A function that checks if a JSON schema is an JSON enum schema.

The Gist

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

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

const isEnum = isEnumSchema(schema)

Parameters

ParameterTypeDescription
schemaT_JSONSchemaThe JSON schema to check.

Returns

(boolean) Whether the schema is an enum schema.

On this page