MCPcopy Index your code
hub / github.com/dataease/SQLBot / validateValueBySchema

Function validateValueBySchema

frontend/public/swagger-ui-bundle.js:31027–31210  ·  view source on GitHub ↗
(s, o, i, a, u)

Source from the content-addressed store, hash-verified

31025 'function' == typeof i ? i(s()) : o(i)
31026 }
31027 function validateValueBySchema(s, o, i, a, u) {
31028 if (!o) return []
31029 let _ = [],
31030 w = o.get('nullable'),
31031 x = o.get('required'),
31032 C = o.get('maximum'),
31033 j = o.get('minimum'),
31034 L = o.get('type'),
31035 B = o.get('format'),
31036 $ = o.get('maxLength'),
31037 U = o.get('minLength'),
31038 V = o.get('uniqueItems'),
31039 z = o.get('maxItems'),
31040 Y = o.get('minItems'),
31041 Z = o.get('pattern')
31042 const ee = i || !0 === x,
31043 ie = null != s,
31044 ae = ee || (ie && 'array' === L) || !(!ee && !ie),
31045 ce = w && null === s
31046 if (ee && !ie && !ce && !a && !L) return (_.push('Required field is not provided'), _)
31047 if (ce || !L || !ae) return []
31048 let le = 'string' === L && s,
31049 pe = 'array' === L && Array.isArray(s) && s.length,
31050 de = 'array' === L && We().List.isList(s) && s.count()
31051 const fe = [
31052 le,
31053 pe,
31054 de,
31055 'array' === L && 'string' == typeof s && s,
31056 'file' === L && s instanceof lt.File,
31057 'boolean' === L && (s || !1 === s),
31058 'number' === L && (s || 0 === s),
31059 'integer' === L && (s || 0 === s),
31060 'object' === L && 'object' == typeof s && null !== s,
31061 'object' === L && 'string' == typeof s && s,
31062 ].some((s) => !!s)
31063 if (ee && !fe && !a) return (_.push('Required field is not provided'), _)
31064 if ('object' === L && (null === u || 'application/json' === u)) {
31065 let i = s
31066 if ('string' == typeof s)
31067 try {
31068 i = JSON.parse(s)
31069 } catch (s) {
31070 return (_.push('Parameter string value must be valid JSON'), _)
31071 }
31072 ;(o &&
31073 o.has('required') &&
31074 isFunc(x.isList) &&
31075 x.isList() &&
31076 x.forEach((s) => {
31077 void 0 === i[s] && _.push({ propKey: s, error: 'Required property not found' })
31078 }),
31079 o &&
31080 o.has('properties') &&
31081 o.get('properties').forEach((s, o) => {
31082 const w = validateValueBySchema(i[o], s, !1, a, u)
31083 _.push(...w.map((s) => ({ propKey: o, error: s })))
31084 }))

Callers 1

Calls 15

isFuncFunction · 0.85
equalsMethod · 0.80
getMethod · 0.65
addMethod · 0.65
WeFunction · 0.50
pushMethod · 0.45
isArrayMethod · 0.45
someMethod · 0.45
parseMethod · 0.45
hasMethod · 0.45
forEachMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected