Schema
/ API Reference / BuildersSchema
/ API Reference / BuilderscreateEnumSchema
A function that creates a JSON enum schema.
The Gist
import { createEnumSchema } from '@weser/schema'
const schema = createEnumSchema(['foo', 'bar'])
const schemaWithOptions = createEnumSchema(['foo', 'bar'], {
default: 'foo',
})
Parameters
Parameter | Type | Description |
---|---|---|
values | Array<string> | The values of the enum schema. |
options | Options? | The options for the enum schema. |
Options
Parameter | Type | Description |
---|---|---|
description | string ? | The description of the enum schema. |
default | string ? | The default value of the enum schema. |
© 2024-present Robin Weser. All Rights Reserved.