The entire JSON file is rather large so I’ve only taken out the subsection I’ve had an issue with. { "diagrams": { "5f759d15cd046720c28531dd": { "_id": "5f759d15cd046720c28531dd", "offsetX": 320, "offsetY": 42, "zoom": 80, "modified": 1604279356, "nodes": { "5f9f5c3ccd046720c28531e4": { "nodeID": "5f9f5c3ccd046720c28531e4", "type": "start", "coords": [ 360, 120 ], "data": { "name": "Start", "color": "standard", "ports": [ ..
Category : jsonschema
I am trying to validate around 100 JSON Objects against a JSON schema to see if all the fields along with the type are as per the schema or not. I tried using Jsonschema and schema-validation using nodejs but they just returned success on all instances Below implementation could be completely wrong , my expected ..
I am having a CI service that validates YAML files using JSON schema. The solution works by firstly converting the YAML to JSON using js-yaml and then by checking the schema using ajv sample code: import { load } from ‘js-yaml’; import { default as Ajv } from ‘ajv’; import schema from ‘../../schema.json’; const ajv ..
I am using react-jsonschema-form to build a multi step form in React. One of the requirements is to use material-ui Toggle Buttons for boolean field. I was able to create a custom field but not sure how the validations work in this case. Even after selecting a value I get boolean value required validation message. ..
I wanted a JSON schema that could have 3 fields: num, key1, and key2. Both num and key1 are mandatory fields. The field key2 is mandatory ONLY WHEN the key1 was provided a value of ‘abc’. Here is the schema that I have created: schema = { type: ‘object’, additionalProperties: false, properties: { num: { ..
I m using react-jsonschema-form generator with NJsonSchema. After submit form i record json output and i want to use form for edit with submitted data any time. But i cannot find a way create the form with submitted data before. After try some json schema updates, I realize, the value keys in json not for ..
I’m using JSON schema and Ajv to make sure that the selected JSON is valid in the system. I’ve succeeded checking the maximum length of string by writing like this: "maxLength": 20 But I don’t want to repeat myself. DRY. Is there any way to use const like this? const MAX_LENGTH = 20 "maxLength": MAX_LENGTH ..

Considering the below definition { type: ‘object’, properties: { conditional: { title: ‘Device Status’, $ref: ‘#/definitions/deviceStatus’, }, }, definitions: { deviceStatus: { title: ‘Device Status’, type: ‘object’, properties: { deviceStatus: { type: ‘string’, title: ‘Device Status’, default: ‘admin-status’, enum: [‘oper-status’, ‘admin-status’], enumNames: [‘Operational Status’, ‘Administrative Status’], }, }, required: [‘deviceStatus’], dependencies: { deviceStatus: { oneOf: ..
this is my route: fastify.route({ method: "GET", url: "/foo/:foo_id", schema: { params: { foo_id: { type: "string" }, }, response: { 200: { oneOf: [ { type: "string" }, { type: "number" }, ], }, }, }, handler: fooHandler, }) when I try to start the server I get this error message: { "code":"FST_ERR_SCH_SERIALIZATION_BUILD", "message":"Failed ..
I have a payload that i want to validate using JSON schema, but there this case that i don’t know how to translate to a schema. Let’s say i have this object: { jobs: [ { title: "Developer", salary: "100", actual: false }, { title: "Plumber", salary: "200", actual: true }, { title: "Teacher", salary: ..
Recent Comments