UNPKG

json-schema-to-joi

Version:

Converts JSON schema to Joi typescript code

29 lines (28 loc) 919 B
import { JoiSchema } from './types'; export declare const enum JoiSpecialChar { OPEN_JOI = 0, CLOSE_JOI = 1, OPEN_TITLE = 2, CLOSE_TITLE = 3, REFERENCE = 4, LAZY = 5, LINK = 6, OPEN_BRACE = "{", OPEN_BRACKET = "[", OPEN_PAREN = "(", CLOSE_BRACE = "}", CLOSE_BRACKET = "]", CLOSE_PAREN = ")", COMMA = ",", COLON = ":", SEMI = ";", IMPORTED_JOI_NAME = 200, IMPORTED_EXTENDED_JOI_NAME = 201 } export declare const OPEN: JoiSpecialChar[]; export declare const CLOSE: JoiSpecialChar[]; export declare const OPEN_CLOSE: JoiSpecialChar[]; export declare type JoiStatement = string | JoiSpecialChar; export declare function openJoi(statement: JoiStatement[]): JoiStatement[]; export declare function closeJoi(statement: JoiStatement[]): JoiStatement[]; export declare function generateJoiStatement(schema: JoiSchema, withTitle?: boolean): JoiStatement[];