Skip to main content
Filter by
Sorted by
Tagged with
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, ...
blueFast's user avatar
  • 43.7k
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#", ...
tom redfern's user avatar
  • 31.6k
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....
evanmcdonnal's user avatar
  • 47.7k
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 ...
senasi's user avatar
  • 1,684
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)?
Fresa's user avatar
  • 1,461
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 ...
ipengineer's user avatar
  • 3,297
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 ...
user3486184's user avatar
  • 2,317
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?
Slava Fomin II's user avatar
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 ...
Jan Vlcinsky's user avatar
  • 43.9k
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, ...
Julien N's user avatar
  • 3,910
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"...
lm.'s user avatar
  • 4,281
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?
JB Hurteaux's user avatar
  • 4,528
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, "...
Kyle Falconer's user avatar
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 ...
Peter G.'s user avatar
  • 7,984
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 ...
MaxiWheat's user avatar
  • 6,221

15 30 50 per page
1
2 3 4 5
235