I have this class where I try to instantiate Ajv with the new keyword and I get this error:     TypeError: Ajv is not a constructor   Code:  import * as Ajv from "ajv";      export class ValidateJsonService {         validateJson(json, schema...
Here's my JSON Schema:  {   "required": [     "username",     "password",     "confirmPassword"   ],   "properties": {     "username": {       "minLength": 3,       "type": "stri...
I'm evaluating using JSON Schema for validating form data.  I can use it to validate my form data when you click submit using AJV and then check it again on the server using a PHP implementation of JSON Schema.  That part sounds great, but I'...
I have an AJV schema like this:  // schema.js module.exports = {   title: 'task',   description: 'A Task Schema',   type: 'object',   properties: {     object_city: {       title: 'City',       type:'string'...
I need to validate JSON files in following way:  const setupSchema = fs.readFileSync(schemaDir +'/setup.json');   and compiling:  const setupValidator = ajv.compile(setupSchema);   My issue is that line:  console.log( setupValidator(''...
This question pertains to ajv.  How can I get the schema being validated?  e.g.  const validatePromise = ajv.compileAsync({...options.schema, $async: true});  validatePromise.then(validate => {     validate(value).then(() => {         // valida...
My schema looks like something like this:  schema: {   type: 'object',   properties: {     id: {       type: 'string'     }   } }   I want to be allowed to set string or null, How can I do that?...
I find it very hard to work with the error message from Ajv when using notin my schema. In my use case, I want to validate two props not being of the same value. Consider this example:  schema.json  {   "$schema": "http://json-schema.org/...
I have been searching for a way to compile multiple json schemas with ajv (Another JSON Schema Validator) at once. I have tried following approach and it works (code sample below) but I'm not sure that it is the proper way to do it, because accor...
{         [{       type: 'personal'       address: ['1','2']     },     {       type: 'business'       address: [2,3]     }] }   how can validate all the arrays address object, in this case , address is not unique....

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.