Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const {uniqBy, startCase} = require('lodash')
const generateHelpUrl = require('@sanity/generate-help-url')
const schemaCompiler = require('@sanity/schema')
const oneline = require('oneline')
const helpUrls = require('./helpUrls')
const SchemaError = require('./SchemaError')
const Schema = schemaCompiler.default || schemaCompiler
const skipTypes = ['document', 'reference']
const allowedJsonTypes = ['object', 'array']
const disallowedCustomizedMembers = ['object', 'array', 'image', 'file', 'block']
const scalars = ['string', 'number', 'boolean']
function getBaseType(baseSchema, typeName) {
return Schema.compile({
types: baseSchema._original.types.concat([
{name: `__placeholder__`, type: typeName, options: {hotspot: true}}
])
}).get('__placeholder__')
}
function getTypeName(str) {
const name = startCase(str).replace(/\s+/g, '')
return name === 'Number' ? 'Float' : name