3,519
questions
266
votes
12
answers
396k
views
Tool to generate JSON schema from JSON data [closed]
We have this json schema draft. I would like to get a sample of my JSON data and generate a skeleton for the JSON schema, that I can rework manually, adding things like description, required, etc, ...
178
votes
3
answers
128k
views
jsonSchema attribute conditionally required
In jsonSchema you can indicate whether defined fields are mandatory or not using the "required" attribute:
{
"$schema": "http://json-schema.org/draft-04/schema#",
...
170
votes
4
answers
176k
views
Specify a value can be a string or null with JSON Schema
Hopefully this isn't obvious to others because I find the docs at https://json-schema.org/ to be lacking in finer details. I'm getting a block of JSON with some properties that can be null or a string....
158
votes
2
answers
215k
views
Correct way to define array of enums in JSON schema
I want to describe with JSON schema array, which should consist of zero or more predefined values. To make it simple, let's have these possible values: one, two and three.
Correct arrays (should ...
134
votes
6
answers
56k
views
Json Schema file extension
Is there any naming convention for a json schema file extension? XML has .xsd (XML Schema Definition), what should json schema files have, .jsd (JSON Schema Definition)?
133
votes
3
answers
53k
views
Only allow properties that are declared in JSON schema
I am using json-schema and wanting to only allow properties that are declared in this file to pass validation. For instance if a user passes a "name" property in their json object it will fail this ...
126
votes
4
answers
132k
views
How do I require one field or another or (one of two others) but not all of them?
I am having trouble coming up with a JSON schema that will validate if the JSON contains either:
one field only
another field only
(one of two other fields) only
but not to match when multiples of ...
113
votes
3
answers
127k
views
How to define UUID property in JSON Schema and Open API (OAS)
When using JSON Schema and Open API specification (OAS) to document a REST API, how do I define the UUID property?
93
votes
7
answers
127k
views
How to generate JSON-Schema from Swagger API Declaration
I have Swagger API Declaration for services using Swagger v 1.2.
My original feeling about Swagger was that it is very close to JSON Schema (Draft 3 and lately Draft 4) and it shall be relatively easy ...
87
votes
8
answers
120k
views
Generate C# classes from JSON Schema [closed]
I'm creating a C# WCF Web Service that return a lot of data in a JSON format.
The client is an iPad application that is currently being developped by another team, So I'm working on specifications, ...
85
votes
5
answers
51k
views
JSON schema : "allof" with "additionalProperties"
Suppose we have schema following schema (from tutorial here):
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"address": {
"type": "object",
"properties"...
83
votes
5
answers
151k
views
Generate Json schema from XML schema (XSD) [closed]
Does anybody know how to generate a JSON schema from a existing XML schema (XSD file)?
Are there any tools available for this?
80
votes
1
answer
139k
views
JSON Schema definition for array of objects
I've seen this other question but it's not quite the same, and I feel like my issue is simpler, but just isn't working.
My data would look like this:
[
{ "loc": "a value 1", "toll" : null, "...
77
votes
5
answers
92k
views
Validating JSON against Swagger API schema
I created an API spec from some JSON files and I am trying to test if the files validate against the API spec.
There are some good tools to validate against JSON Schema, but I did not have chance to ...
73
votes
2
answers
45k
views
How to define a JSON schema that requires at least one of many properties
I would like to know if I can define a JSON schema (draft 4) that requires at least one of many properties possible for an object. I already know of allOf, anyOf and oneOf but just can't figure out ...