How to use the getSchema function from tv4
Find comprehensive JavaScript tv4.getSchema code examples handpicked from public code repositorys.
GitHub: geraintluff/tv4
146 147 148 149 150 151 152 153 154
Return a schema from the cache. * `uri` the uri of the schema (may contain a `#` fragment) ````js var schema = tv4.getSchema('http://example.com/schema'); ```` ##### getSchemaMap()
190
0
34
+ 3 other calls in file
140 141 142 143 144 145 146 147 148 149
function loadSchema(schema, callback) { return Promise.resolve() .then(() => { const tld = !isString(schema) || schema.indexOf('localhost') === -1; if (isString(schema) && validatorJS.isURL(schema, { require_tld: tld })) { const cachedSchema = tv4.getSchema(schema); if (cachedSchema) { return cachedSchema; } return makeRequest(schema)
0
2
8
+ 11 other calls in file
43 44 45 46 47 48 49 50 51 52
if (typeof schema === 'string') { var uri = schema; baseUri = baseUri || 'http://schema.ninjablocks.com/'; var resolvedUri = tv4.resolveUrl(baseUri, uri); schema = tv4.getSchema(resolvedUri); if (!schema) { throw new Error('Failed to resolve schema $ref. ' + (urlHistory? Object.keys(urlHistory).join(', ') : uri)); } }
6
2
14
4 5 6 7 8 9 10 11 12
addSchema: function (uri, schema) { return TV4.addSchema(uri, schema); }, getSchema: function (uri) { return TV4.getSchema(uri); } };
1
4
3
12 13 14 15 16 17 18 19 20 21
function validationErrorToString(e) { return (e.dataPath) ? e.dataPath + " -- " + e.message : e.message; } exports.validateJsonSyntax = function (json, schemaUri) { var schema = tv4.getSchema(schemaUri); var ret = tv4.validateMultiple(json, schema, true); return { valid: ret.valid, errors: _.map(ret.errors, validationErrorToString),
0
2
9
+ 3 other calls in file
GitHub: gabrielmancini/ecwm
21 22 23 24 25 26 27 28 29
tv4.addSchema(capitalizedSchema, schemas[key]); function Model (doc) { Base.call(this, doc); this.me = capitalized; this.schema = tv4.getSchema(capitalizedSchema); }; Model.prototype.__proto__ = Base.prototype; //inherits(Model, Base);
0
0
0
tv4.validate is the most popular function in tv4 (982 examples)