json-schema#JSONSchema7TypeName TypeScript Examples

The following examples show how to use json-schema#JSONSchema7TypeName. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: properties.ts    From prisma-json-schema-generator with MIT License 6 votes vote down vote up
function getJSONSchemaScalar(
    fieldType: PrismaPrimitive,
): JSONSchema7TypeName | Array<JSONSchema7TypeName> {
    switch (fieldType) {
        case 'Int':
        case 'BigInt':
            return 'integer'
        case 'DateTime':
        case 'Bytes':
        case 'String':
            return 'string'
        case 'Float':
        case 'Decimal':
            return 'number'
        case 'Json':
            return ['number', 'string', 'boolean', 'object', 'array', 'null']
        case 'Boolean':
            return 'boolean'
        default:
            assertNever(fieldType)
    }
}