Questions tagged [jsonschema]
A JSON Schema is a JSON document (an object) which defines constraints on what other JSON documents (the instances) should obey; it can also be used to interpret instances so as to provide links to external resources (hyper schema).
3,279
questions
0
votes
0
answers
8
views
PyYAML Not Parsing `on` Key Correctly from GitHub Action YAML file [duplicate]
I am experimenting with jsonschema to validate GitHub Action files. I've noticed that while loading the workflow YAML file using yaml.load(), the on key isn't read correctly. I've also tried using ...
0
votes
0
answers
9
views
JSON Schema validation: Validate only single matching object out of array of objects
I need to validate a JSON using JSON schema.
Sample JSON is something like this
{
"props": [
{
"label": "Residential",
"...
0
votes
0
answers
20
views
JSON schema: Property must exist *anywhere* at a lower level
Is it possible to validate a json-schema requiring at least one occurrence of a certain property/value at a lower level?
For the json code at the bottom, I can get the schema to require a C in a ...
0
votes
0
answers
22
views
How to convert any navigation property Into JSON format? And, how to make JSON Schema from multiple navigation property?
I want to create JSON Schema from different classes, which I mentioned all below.
This is the Schedule Class.
public class Schedule : BaseEntity, IAggregateRoot
{
public string Name { get; set;...
1
vote
1
answer
16
views
JSON schema to force number to be a power of 10
I'd like to define a JSON schema which requires a number to be a power of 10 (for example, but not limited to 1e5, 100, 10, 1, 0.1, 1e-5). I tried to declare it using
"scaleFactor": {
&...
0
votes
0
answers
28
views
Avro logicalType for Date is giving exception : java.lang.ClassCastException: class java.util.Date cannot be cast to class java.lang.Number
My question in related to avro schema.
I have java pojo like below
public class demo {
private Date startedAt;
private Date completedAt;
}
I have generated avro schema for above class like ...
0
votes
0
answers
18
views
How to use AJV to validate page id against navigation ids in JSON schema
I am trying to create ajv based json schema validations. I want to validate if page.id value is equal to any one navigation.ids present in an array. For example:
`"page": {
"id"...
0
votes
1
answer
38
views
Json Schema validate an object exists in the json document (lookup value)
Is it possible to do business rule validation using the json-schema spec?
I am trying to use https://json-schema.org/ to validate a json structure in multitple services. One of the rules is an object ...
0
votes
0
answers
31
views
Kafka JsonSchema Producer Issues with incompatible Schema
I'm trying to produce to a Kafka topic which has a JsonSchema set for validation, this is done in Groovy script and I have the equivalent class with all the fields that are present in the schema.
This ...
2
votes
1
answer
26
views
enum in json-schema with a (RegEx) pattern
A certain category in my json dataset should be restricted to a limited number of values, so I put them in a list in enum. There are two issues:
In some cases it is necessary to add an asterisk to ...
0
votes
0
answers
37
views
Find property of a json key inside schema and update the value accordingly
I have a patch that updates a part of json, The patch contains data in form of operations ('fast-json-patch' style) and some part of data needs to be modified for example concatenated with a prefix.
...
0
votes
2
answers
82
views
Generate json schema and validate json against the schema
How do I generate a JSON schema in Python for the below JSON and validate every json against the schema?
Requirements:
There is a type which can be CSV or JSON or JSON
There is a list of properties.
...
1
vote
0
answers
13
views
Helm3 JSON Schema Validation based on enabled is true or false
I have the following scenario for helm for kubernetes. I am using json schema validator to validate the following
autoscaling:
minReplicas: 1
maxReplicas: 15
cpu:
enabled: true
...
0
votes
0
answers
18
views
If then block from json schema to openapi yaml format
I have the following json schema (which basically generated from a openapi.yaml file),
I modified the json schema for some needs but I don't found the correct syntax for express the 'IF' block which ...
0
votes
0
answers
23
views
How can I get pydantic to generate Enum descriptions in a json schema?
I am trying to generate a JSON schema from a Pydantic model which contains several options, each with its own description. The goal is to show the options and the descriptions for a developer working ...
0
votes
0
answers
15
views
How to replace a whole `anyOf` object with a custom field?
I have a specific anyOf field in my form, and I need the whole field replaced with a custom field.
I can easily replace a whole plain object with a custom field like this [sandbox link]:
const ...
0
votes
0
answers
11
views
How to customize schematics schema.json?
Is it possible to customise Angular schematics schema.json?
I wanna add extra properties to the schema.
In other words, I would like top extend the schematics schema.json syntax. How to do that?
{
&...
0
votes
1
answer
105
views
Can the Flatten activity in ADF data flow handle dynamic unroll by
I'm importing items from Cosmos db, however each item can potentially have a different schema structure. Below are a few examples of how they could look.
Ex.1
{
"id": "01-000008&...
0
votes
0
answers
9
views
Validate the value of a field of a object based on the values of objects located in other files using JSON schema
I want to validate that the value of a field in a json coincides with the values of the fields of other objects located in different files using Json Schema.
Take that I have several Scripts.json ...
0
votes
1
answer
54
views
Restrict values of an array type
It cannot be easier, frankly, however I cannot find the solution anywhere.
I would like to accept an array from the front, with restricted values.
Having the following jsonschema:
const models = {
...
0
votes
1
answer
26
views
Null allowed for JSON attribute of type object?
If I have a JSON schema which defines an optional property of type object is it allowed to have null as a value? Would null be logically equivalent to the empty object {}? I would like to understand ...
0
votes
1
answer
18
views
Why is it valid jsonschema for $id to be a path (i.e. end with a /)
The jsonschema test suite contains many test cases.
This test case
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "http://...
0
votes
0
answers
27
views
AJV JSON schema validation - Refering to value of maximum characters allowed, throws an error in console
In the below given example:
{
"default": "adsds",
"max": 1
}
I wanted to refer to the 'max' value that is provided dynamically and wanted to validate the number of ...
0
votes
0
answers
33
views
How to add a dynamically generated JSON Schema to a current document in a visual studio code extension?
I would like to generate a JSON schema dynamically at runtime in a visual studio code extension.
For example like that, the original would be generated, this is just a static example.
const schema = ...
0
votes
1
answer
70
views
Add aditional information to json-schema and get it when validate through the networknt json validator
I'm using json-schema to validate a JSON payload with the help of networknt json-schema-validator. Now I need to set a severity level like "warning" or "error" to each attribute, ...
0
votes
1
answer
28
views
For JSON Schemas, is it better to use "allOf" for referenced definitions?
In a JSON schema, when a property references another defined schema, to preserve the type of the referenced definitionis it better to wrap the referenced definition in an "allOf" and ...
0
votes
0
answers
42
views
AJV JSON schema validation - How to validate object containing object for uniqueness using ajv json schema validator
I have the example like below,
"obj2":
{
{
"prop1": "baz", "prop2": 999
},
{
"prop1": "qux", "prop2": ...
0
votes
1
answer
33
views
How to define a JSON schema that has variable required properties
I would like to know if I can define a JSON schema (draft 2019-09) that requires at least one of many properties possible for an object, and some times multiple of those properties. I already know of ...
0
votes
0
answers
37
views
AJV JSON schema validation - Referencing to key's value within schema
my object is like below as per schema:
{
"name": "new_york", // new_york
"address": {
"type": "type1",
"title&...
0
votes
1
answer
30
views
How do I use a json schema to match either empty array or both entries match
I'm trying to write a json schema for an optional input. It currently looks like this:
"something": {"type": "array",
"items": {"type": &...
0
votes
0
answers
39
views
json schema validation - conditional properties not validating correctly
I have a json object formatted like below
{
"notificationType": "Directed",
"userPaths": [
"organization.SsoId"
],
"id": "...
0
votes
0
answers
16
views
using AJV with javascript, how to specify the schema of an array that must have a specific item?
cats: {
type: "array",
items: {
type: "string",
minLength: 1,
},
minItems: 3,
},
How do I further specify that the value &...
0
votes
1
answer
40
views
Json validator validates successfully for any string inputs
Root Schema:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"deviceId": {
"description": &...
0
votes
1
answer
44
views
Confluent Schema Registry Compatibility Modes for JSON Schema
I am planning to register KafkaJsonSchemaSerializer with my KafkaProducer to send JSON serialized messages to Kafka. According to the documentation I understand the serializer will derive the schema ...
0
votes
0
answers
52
views
Create reversable JSON Schema from SQL Server DDL (table)
tl;dr; Convert a SQL Server table's DDL into JSON Schema && the Schema into DDL.
Let's pretend you have a table's DDL:
CREATE TABLE Customers
(
Id INT PRIMARY KEY IDENTITY(1, 1)
, ...
0
votes
1
answer
48
views
How to setup schema registry for multiple event types in the same kafka topic?
According to https://docs.confluent.io/platform/7.3/schema-registry/fundamentals/serdes-develop/serdes-json.html#multiple-event-types-in-the-same-topic I have to define top-level schema using oneOf:
{
...
1
vote
1
answer
67
views
Going from pydantic to aws_cdk.aws_apigateway.JsonSchema?
Anyone know how to go from a pydantic model to an aws_cdk.aws_apigateway.jsonSchema? We are using it for validation and are looking to convert it to have validation take place at the api gateway. Been ...
0
votes
0
answers
51
views
Python json schema get property parameters based on path
I am using Python jsonschema package for JSON config file validation. Everything works perfectly. But now I want to read the property parameters (for example title, description, minimum ...) for ...
0
votes
1
answer
94
views
Azure Logic Apps JSON Schema Validation - How to Invalidate Empty Strings?
I found when applying JSON Schema validation in Logic Apps 1 e.g.1
"FirstName": {
"minLength": 1,
"type": "string"
}
Then Logic Apps does ...
2
votes
1
answer
89
views
python jsonschema - get the reason of validation failure
I have a json file which I need to compare with official F5 schema. Everything works but when I do any mistake it does not show me a path or an error, it just shows me that its valid under any of the ...
0
votes
1
answer
18
views
JsonSchema conditional requirements in sub-object
This is the jsonschema I'm using:
{
"type":"object",
"properties":{
"a":{
"type":"number",
"minimum":...
0
votes
0
answers
48
views
JSON Schema Catalog with relative URL in VS Code
I have multiple JSONs schemas for verifying different YAML file types.
I have collected them all in a JSON catalog (similar to the official schema store catalog.
In my catalog I have those schemas ...
0
votes
1
answer
85
views
Conditional (if-else) schema validation for body in Fastify?
Is it possible to do conditional validation on the request.body in Fastify? Fastify uses ajv for it's schema validation, but I cannot seem to get it to work.
I either get errors from strict mode ...
1
vote
0
answers
107
views
Add custom example value and schema in the Swagger Documentation for a FastAPI Get Response
I am creating a GET request in FastAPI as follows:
@router.get("/{ngo_id}")
def get_ngo_by_id(ngo_id: str):
# Get the NGO from the database
db = firestore.client()
ngo_ref = ...
0
votes
0
answers
108
views
Converting avro-schema to json-schema
I want to consolidate two sets of schema definitions, one set is avro schema, and the other is json schema. In the future, I would like to develop schemas in one language and then generate the ...
1
vote
0
answers
74
views
JSON UI Helper or JSON Lint with dropdown suggestions using a JSON schema
My client needs to have an USER interface where they can build a JSON
The JSON is defined and validated by its schema
For example, if you could go here https://developers.google.com/people/api/rest/v1/...
0
votes
1
answer
78
views
JSON Schema to compare & validate dependent attributes from different scope [duplicate]
I have following JSON structure
{
"customFields": {
"paymentMethods": [
{
"tokenizedCard": "11223",
&...
0
votes
0
answers
35
views
JSON Schema: combining unevaluatedProperties and $ref: #
In JSON Schema, I would like to define a property which allows as its contents anything from the root schema, plus one extra property.
For example, say I have a simple schema defining one property ...
0
votes
0
answers
44
views
How to remove allOf from json schema based on a json value
The following json schema works the following way (DEMO):
If switch is true, objectDependingOnSwitch will have a string property called switchIsTrue.
If switch is false, objectDependingOnSwitch will ...
0
votes
1
answer
33
views
unable to validate json schema for polymorphic object of array
Trying to validate below json against json schema for polymorphic type objects of array
Using dependency
<dependency>
<groupId>com.networknt</groupId>
<artifactId>...