Questions tagged [ajv]

Ajv is a JSON schema validators for node.js and browser. It supports draft 4, 6, and 7, and additional extras beyond JSON Schema that make it more useful.

Ajv is a JSON Schema validator for Node.js and the browser. It supports draft 4, 6, and 7, and additional extras beyond JSON Schema that make it more useful.

Related tags:

375 questions
0
votes
1 answer

Validate multiple occurrences of query parameters using json-schema and AJV

I want to validate multiple occurrences of the same query parameter using AJV. My OpenApi schema looks something like this: ... /contacts: get: parameters: - name: user_id in: query schema: type: integer ... I…
Aurelien
  • 339
  • 3
  • 12
0
votes
1 answer

mean.io / no matching version found for ajv@undefined

I wanted to run mean.io and got this error after npm install. npm ERR! code ETARGET npm ERR! notarget No matching version found for ajv@undefined npm ERR! notarget In most cases you or one of your dependencies are requesting npm ERR! notarget a…
Bavaria
  • 7
  • 4
0
votes
1 answer

Accessing "other errors" from custom keyword code during validation time?

Can I check for previously generated validation errors, while validating the custom keyword? This is the best I could come up with so far: ajv.addKeyword('fromInput',{ modifying:true, compile: function (schema, parentSchema, it){ return…
Nenad
  • 1
  • 1
0
votes
1 answer

AJV is not validating my schema

I am facing problem regarding AJV Schema Validator. I have following schema { "$id": "create-offer.json#", "body": { "type": "object", "properties": { "statusCode": { "type": "number" …
0
votes
1 answer

Not able to understand ajv validation output for a FHIR resources

I am validating a FHIR resource using ajv. ajv -s fhir.schema.json -d SampleOperationOutCome.json This is the SampleOperationOutCome.json file { "resourceType": "OperationOutcome", "id": "101", "text": { "status": "additional", "div":…
Marti Pàmies Solà
  • 611
  • 1
  • 6
  • 12
0
votes
1 answer

How can I validate different schemas based on an enumerated property value with AJV?

I need to validate a json document depending the value in one of the properties, specifically an enum property. This is the JSON document to be validated: { "req": { "user": "", "company": "", "dept": "", "class":…
Mohit
  • 183
  • 1
  • 3
  • 18
0
votes
1 answer

Modify data using AJV for Json Schema

I'm using AJV (Another Json schema validator) on NodeJs. I've the following schema var schema = { "$id": "testSchema.json", "type": "object", "$schema": "http://json-schema.org/draft-06/schema#", "additionalProperties": false, …
Kshateesh
  • 571
  • 1
  • 8
  • 21
0
votes
0 answers

Ovewirte property value in json schema Using AJV

I've the following schema var schema = { "$id": "postClientSchema.json", "type": "object", "definitions": {}, "$schema": "http://json-schema.org/draft-06/schema#", "additionalProperties": false, "dynamicDefaults": { …
Kshateesh
  • 571
  • 1
  • 8
  • 21
0
votes
1 answer

Using ajv to guarantee the value types, at specific indices, in an array

I am trying to use ajv to guarantee an array adheres to strict rules about what is a valid value. I'm not sure about what modifications or additional keywords to use to achieve the result I'm looking for. Could use some insight. Note: I have this…
Jasonovich
  • 621
  • 5
  • 13
0
votes
1 answer

How to resolve a JsonSchema and move a sub-schema up to the root?

I wrote a schema in JavaScript because its easier, which I can simply run to turn it into JSON. That part is all fine, but now I want to extract a sub-schema/definition because the application I want to use it with won't let me specify a JSON path…
mpen
  • 272,448
  • 266
  • 850
  • 1,236
0
votes
2 answers

Pass value to Json schema Definition

I'm using AJV Schema validator on NodeJS and wish to add userID from sessionObject to every incoming payload so that I can store userID for each transaction. I wish to know if that can be done in json schemas. sample Incoming Client payload -…
Kshateesh
  • 571
  • 1
  • 8
  • 21
0
votes
1 answer

JSON Schema draft 07 if then statements for conditional validation

I'm trying to create a schema that has a slightly different structure depending upon values and decided to use draft 07 and ajv to validate it. The structure I'm trying to create is as follows - "url":{ "some-random-string":{ …
0
votes
1 answer

Using Thenable Interfaces with ES6 Promises in TypeScript

Some libraries offer Thenable Interface typings f.e. AJV. There is something I don't understand about them. Given this minimal code const foo: Ajv.Thenable = new Promise((resolve, reject) => { if ("condition") …
Krenor
  • 621
  • 10
  • 27
0
votes
1 answer

Using negative lookbehind with jsonschema

I'm using Node 9.2.0 and ajv 6.0.0. I have a schema that I wish to use negative lookbehind on, it's defined like: { "$schema": "http://json-schema.org/draft-07/schema#", "title": "release format", "description": "A Release Format", …
Jarede
  • 3,310
  • 4
  • 44
  • 68
0
votes
1 answer

JSON-Schema: Using relative URLs in $ref

I'm having trouble using a parent schema that references a child schema via a relative URL. Here's my parent schema: { "$schema": "http://json-schema.org/draft-07/schema#", "description": "The parent schema.", "type": "object", "properties":…
Horace
  • 346
  • 2
  • 14
1 2 3
24
25