UNPKG

@sprucelabs/schema

Version:

Static and dynamic binding plus runtime validation and transformation to ensure your app is sound. 🤓

24 lines (23 loc) • 821 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const AbstractField_1 = __importDefault(require("./AbstractField")); class IdField extends AbstractField_1.default { static generateTemplateDetails(options) { const { language, definition } = options; const { isArray } = definition; const arrayNotation = isArray ? '[]' : ''; return { valueType: language === 'go' ? `${arrayNotation}string` : `string${arrayNotation}`, }; } toValueType(value) { return `${value}`; } } IdField.description = 'A unique identifier field.'; exports.default = IdField;