jsonsystems / json-schema Goto Github PK
View Code? Open in Web Editor NEWJSONSchema.Net Public Repository
License: Apache License 2.0
JSONSchema.Net Public Repository
License: Apache License 2.0
I tried loading a schema using oneOf, and those properties aren't shown in the generated schema.
(Or I did it wrong. I looked for a "New Property" button in the UI to see if I was missing something, but I didn't see one.)
How can I convert a json schema back to json??
specifically asking in regards to swagger schema json
Thanks in advance!
Hi!
I have found two "minItems" in options of Json.Configuration.Array
But the second one should be "maxItems"
Please, fix this typo on your site https://jsonschema.net/#/
Attaching screenshot
Thank you and have a nice day!
Possibly a regression of #12. Tested in Chrome 75.0.3770.142 and Firefox 68.0.1.
When adding enum values the enum fields start at the top of the app-overlay-footer
element, and quickly get pushed off panel. I think it's a problem with the the way the app-list-value
element is added to the overlay-content
parent div, but not totally sure.
additionalItems
and additionalProperties
may be primitive schema (boolean
) or an object. Currently, loading a schema with a non-primitive value for additionalProperties
and additionalItems
breaks.
http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.
The value of "additionalProperties" MUST be a valid JSON Schema.
This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
Validation with "additionalProperties" applies only to the child values of instance names that do not match any names in "properties", and do not match any regular expression in "patternProperties".
For all such properties, validation succeeds if the child instance validates against the "additionalProperties" schema.
Omitting this keyword has the same behavior as an empty schema.
When loading an existing schema, it fails to properly parse default values. The loaded default value is always 0, empty string, or false.
For each of these test cases, I loaded the schema listed, which was parsed without any error messages, and the second schema was produced. In all cases, the interactive UI for editing matched the second generated schema. Also in all cases, editing via the interactive UI to set the default value was able to result in the original schema.
Integer:
Input:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "integer",
"default": 5
}
}
}
Output:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "integer",
"default": 0
}
}
}
Number: Similar result, 5 becomes 0.
String:
Input:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "string",
"default": "foobar"
}
}
}
Output:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "string",
"default": ""
}
}
}
Boolean:
Input
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "boolean",
"default": true
}
}
}
Output
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "boolean",
"default": false
}
}
}
Hi, jsonschema.net is a great resource. Is the source for the web app available? Sorry if this is an obvious thing- I looked in the github repo and in your gh organization. thanks in advance.
Use Firefox and navigate to "jsonschema.net" - it does not redirect to https://
However, https://jsonschema.net is not flagged in anyway. Everything works in Chrome.
In online tool https://www.jsonschema.net, 'copy to clipboard' function is copying number of lines too.
And, i think, number of lines are not necessary in the copy.
According to #35 omitting $id
-attributes can be done by select ID-type None in the LHS-menu.
I'm unable to find this option in the menu. In which section is it located?
if i click "Copy to clipboard" button and paste on my notepad, i find the order number of line before each line as belowing:
1 {
2 "definitions": {},
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "$id": "http://example.com/root.json",
5 "type": "object",
6 "title": "The Root Schema",
7 "required": [
8 "time",
9 "errno",
10 "error",
11 "data"
12 ],
...
i don't think the order number before each line is adorable:),please help
at current https://jsonschema.net/#/ string min max lengths not reflected after edit
When dealing with JSON Schemas and thus with jsonschema.net as a schema generator it would be really helpful if the general configuration ( Annotations > Infer Title, Infer Description, Infer Default, Infer Examples,...etc) could be saved somehow.
I for example never want these kind of information in my schema and I need to uncheck and correct the settings each time I visit the site for a new schema. :(
In the example JSON :
"tags": [
"home",
"green"
]
Only produce this JSON Schema output :
"examples": [
"home"
]
Could be a good idea to set a 3 values by default and allow user to chose how much example he want.
When I'm editing towards the end of a schema, sometimes the detail pane used to edit things like examples or enums gets stuck off the bottom of the window.
When I remember to do so, I have to add some fake properties at the end of my example JSON to begin with so scrolling works right.
Add options for
Dear,
First of all, I am very grateful to the online generator that provides the json schema, which is really very hard to design!
However, I have encountered a problem in use, please help me solve the problem, the problem is as follows:
When generating the schema specification, how do you not generate attributes with $id?
example:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"username": {
"type": "string"
}
}
}
I have a folder full of json data files, and would prefer to use jsonschema.net because I think it produces good output. This does not seem to be possible through the https://www.jsonschema.net/ web app.
For comparison, this other tool for the cli, supports a batch mode:
https://github.com/snowplow/schema-guru
Allow pasting and editing in the plain view
Using https://json-schema-dev.appspot.com/ on Jun.25:
Trying to load and edit Schema. exclusiveMinimum and exclusiveMaximum set to false via the left column(the settings button). On each number, exclusiveMinimum and exclusiveMaximum are set to false.
Click "preview code", the result is:
{
"$id": "/properties/radius/properties/amount",
"type": "number",
"title": "The Amount Schema",
"default": 0,
"examples": [
12.34
],
"minimum": 0
}
but in the JSON Schema document generated, the number is still "exclusiveMinimum".
Browser: Firefox OS: macOS
Such bug seems not exist on the original site, but the old site does not have Schema import so I am trying on the dev site.
I was first thinking the editor was broken, but in fact you had to save before changing the view from EDIT
to HTML
.
Why having a button ?
Why not making continuous save, as it's usually done with web application, with an onChange{save()}
?
ps : I put a lot of Issues, but only my #3 is really a priority for me. You've done pretty well for now, I just give you the few missing feature that, I think, will make it awesome ;)
Unable to generate schema for any json by clicking on the infer schema button
Steps to reproduce
Expected result
Actual result
Strings always have pattern: "", should be optional.
When using a JSON of more than 5 deep, on the EDIT
screen the 6th node is at the same padding than the the root node.
If there is a way to improve the readability of this (horizontal scroll ? going back to a root+1 padding but with a color/ branch to point it's a child ?)
Here is the JSON used :
{"d1":[{"d2":[{"d3":[{"d4":[{"d5":[{"d6":[{"d7":[{"d8":[]}]}]}]}]}]}]}]}
Hello,
I can't find a way to edit an existing json-schema.
It seem I need to send the original JSON, and redo all the changes that was done on the json-schema.
Is there a way to do it ?
Thanks,
Blag
The JSON I'm providing is valid, tested like so, and yet I get a red text label displaying "Your JSON*" which I presume indicates the JSON is invalid.
Also, is the source code public?
Edit panels show hidden string values as " "
because they're piped into | json
.
If a string value is hidden, quotes should be hidden too.
Hello,
Here a small issue.
Inputted number are not 'safely' managed.
if value is more than the max of an integer (2,147,483,647) it's trigger the whoops error
if value is a float (0.01) it's trigger the whoops error
If you use the arrow to change your number, it will transform your integer to a float and trigger the error for the same reason of above.
Thanks for this awesome tool ๐ฅ
It looks like the tool is not doing anything with the definition key.
Definitions are stripped when loading a schema with definitions and viewing the result on the right-hand side.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"definitions": {
"widget": {
"type": "object",
"title": "Widget Object",
"required": [
"title",
"type",
"renderType",
"sortOrder"
],
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"default": "",
"examples": [
"Thresholds"
],
"pattern": "^(.*)$"
},
"icon": {
"type": "string",
"default": "",
"examples": [
"ca-graph"
],
"pattern": "^(.*)$"
},
"type": {
"type": "string",
"enum": [
"card",
"html",
"markdown",
"divider",
"comments"
],
"default": "",
"examples": [
"card"
],
"pattern": "^(.*)$"
},
"renderOptions": {
"type": "object",
"default": null
},
"renderType": {
"type": "string",
"enum": [
"AssetGraphs",
"AssetDetails",
"Thresholds",
"Iframe",
"Image",
"Attachments"
],
"default": "",
"examples": [
"AssetGraph"
],
"pattern": "^(.*)$"
},
"sortOrder": {
"type": "integer",
"default": 0,
"examples": [
1
],
"exclusiveMinimum": 0
}
}
},
"column": {
"type": "object",
"title": "Column Object",
"required": [
"styleClass"
],
"additionalProperties": false,
"properties": {
"styleClass": {
"type": "string",
"title": "The Styleclass Schema",
"default": "",
"examples": [
"col-md-6"
],
"pattern": "^(.*)$"
},
"widgets": {
"type": "array",
"title": "Set of Widgets",
"items": { "$ref": "#/definitions/widget" }
},
"rows": {
}
}
},
"row": {
"type": "object",
"title": "Row Object",
"required": [
"columns"
],
"additionalProperties": false,
"properties": {
"columns": {
"type": "array",
"title": "Set of Columns",
"items": { "$ref": "#/definitions/column" }
}
}
}
},
"type": "object",
"title": "The Root Schema",
"required": [
"typical",
"rows"
],
"properties": {
"typical": {
"$id": "#/properties/typical",
"type": "string",
"title": "The Typical Schema",
"default": "",
"examples": [
"MSID"
],
"pattern": "^(.*)$"
},
"rows": {
"type": "array",
"title": "The Rows Schema",
"items": {
"title": "Set of Rows",
"items": { "$ref": "#/definitions/row" }
}
}
}
}
Hi,
I can't find the proper field in the UI, where string Formats (like date, date-time) can we configured?
http://json-schema.org/draft-07/json-schema-release-notes.html#formats
Cheers,
Omid
When submitting a JSON with an array with different object types, the generator picks the first item and assumes the whole array consists of this kind of items.
Here is an example
{
"included": [
{
"id": "1",
"type": "boat_model",
"attributes": {
"name": "Demacia",
"boat_type": "sailboat",
"loa": 16.63,
"beam": 1.23,
"draft": 1.74211606331017,
"cabins": 5,
"wc": 2
}
},
{
"id": "1",
"type": "image",
"attributes": {
"url": "http://roberts.co/krystina",
"main": true
}
}
]
}
There seems to be a solution in JSON:Schema using oneOf
; see this issue.
The generator should go through each element of arrays and check wether they are of the same type and add oneOf
statements if not.
When editing string assertions and min/max length on https://www.jsonschema.net/ it shows "invalid value" when the number has more than one digit (e.g. '32', '10').
The value is saved anyway so it is a bit confusing but doesn't affect generating schema.
I found two funny bugs in the generated examples, possibly related:
"price": 12.3,
produces "price": {
"$id": "/properties/price",
"type": "number",
"title": "The Price Schema ",
"default": 0,
"examples": [
12.300000190734863
]
},
or "Y": 9.386496
produces..."examples": [ 9.386495590209961 ]
"storage": [2,13,5,42]
produces"examples": [ 2, 13, 42 ]
or to exaggerate this:
"numArray": [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
produces
... "examples": [ 0, 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ] // 4 and 5 are missing!
The tree viewer does not seem to display all elements, please see samples and screen shot below where the sourceRecordId
is missing.
Interestingly the inferred schema is not missing this element.
Sample Json
{
"sourceSystem": "test",
"vendorInvoices": [
{
"invoiceDate": "2018-10-09T06:46:10.140Z",
"vendorAccount": "123241239",
"transactionText": "test",
"amount": 34.68,
"currencyCode": "KSH",
"invoiceNumber": "123241239",
"transactionType": 3,
"insuranceAccountNumber": "123241239",
"endorsementNumber": "123241239",
"claimNumber": "123241239",
"policyNumber": "123241239",
"ledgerAccount": "Commission Payable",
"exchangeRate": 19.32,
"company": "test",
"branch": "Head Office",
"department": "Accounts",
"sourceRecordId": "123123ertcbg"
}
]
}
Inferred Schema
1 {
2 "definitions": {},
3 "$schema": "http://json-schema.org/draft-07/schema#",
4 "$id": "http://example.com/root.json",
5 "type": "object",
6 "title": "The Root Schema",
7 "required": [
8 "sourceSystem",
9 "vendorInvoices"
10 ],
11 "properties": {
12 "sourceSystem": {
13 "$id": "#/properties/sourceSystem",
14 "type": "string",
15 "title": "The Sourcesystem Schema",
16 "default": "",
17 "examples": [
18 "test"
19 ],
20 "pattern": "^(.*)$"
21 },
22 "vendorInvoices": {
23 "$id": "#/properties/vendorInvoices",
24 "type": "array",
25 "title": "The Vendorinvoices Schema",
26 "items": {
27 "$id": "#/properties/vendorInvoices/items",
28 "type": "object",
29 "title": "The Items Schema",
30 "required": [
31 "invoiceDate",
32 "vendorAccount",
33 "transactionText",
34 "amount",
35 "currencyCode",
36 "invoiceNumber",
37 "transactionType",
38 "insuranceAccountNumber",
39 "endorsementNumber",
40 "claimNumber",
41 "policyNumber",
42 "ledgerAccount",
43 "exchangeRate",
44 "company",
45 "branch",
46 "department",
47 "sourceRecordId"
48 ],
49 "properties": {
50 "invoiceDate": {
51 "$id": "#/properties/vendorInvoices/items/properties/invoiceDate",
52 "type": "string",
53 "title": "The Invoicedate Schema",
54 "default": "",
55 "examples": [
56 "2018-10-09T06:46:10.140Z"
57 ],
58 "pattern": "^(.*)$"
59 },
60 "vendorAccount": {
61 "$id": "#/properties/vendorInvoices/items/properties/vendorAccount",
62 "type": "string",
63 "title": "The Vendoraccount Schema",
64 "default": "",
65 "examples": [
66 "123241239"
67 ],
68 "pattern": "^(.*)$"
69 },
70 "transactionText": {
71 "$id": "#/properties/vendorInvoices/items/properties/transactionText",
72 "type": "string",
73 "title": "The Transactiontext Schema",
74 "default": "",
75 "examples": [
76 "test"
77 ],
78 "pattern": "^(.*)$"
79 },
80 "amount": {
81 "$id": "#/properties/vendorInvoices/items/properties/amount",
82 "type": "number",
83 "title": "The Amount Schema",
84 "default": 0.0,
85 "examples": [
86 34.68
87 ]
88 },
89 "currencyCode": {
90 "$id": "#/properties/vendorInvoices/items/properties/currencyCode",
91 "type": "string",
92 "title": "The Currencycode Schema",
93 "default": "",
94 "examples": [
95 "KSH"
96 ],
97 "pattern": "^(.*)$"
98 },
99 "invoiceNumber": {
100 "$id": "#/properties/vendorInvoices/items/properties/invoiceNumber",
101 "type": "string",
102 "title": "The Invoicenumber Schema",
103 "default": "",
104 "examples": [
105 "123241239"
106 ],
107 "pattern": "^(.*)$"
108 },
109 "transactionType": {
110 "$id": "#/properties/vendorInvoices/items/properties/transactionType",
111 "type": "integer",
112 "title": "The Transactiontype Schema",
113 "default": 0,
114 "examples": [
115 3
116 ]
117 },
118 "insuranceAccountNumber": {
119 "$id": "#/properties/vendorInvoices/items/properties/insuranceAccountNumber",
120 "type": "string",
121 "title": "The Insuranceaccountnumber Schema",
122 "default": "",
123 "examples": [
124 "123241239"
125 ],
126 "pattern": "^(.*)$"
127 },
128 "endorsementNumber": {
129 "$id": "#/properties/vendorInvoices/items/properties/endorsementNumber",
130 "type": "string",
131 "title": "The Endorsementnumber Schema",
132 "default": "",
133 "examples": [
134 "123241239"
135 ],
136 "pattern": "^(.*)$"
137 },
138 "claimNumber": {
139 "$id": "#/properties/vendorInvoices/items/properties/claimNumber",
140 "type": "string",
141 "title": "The Claimnumber Schema",
142 "default": "",
143 "examples": [
144 "123241239"
145 ],
146 "pattern": "^(.*)$"
147 },
148 "policyNumber": {
149 "$id": "#/properties/vendorInvoices/items/properties/policyNumber",
150 "type": "string",
151 "title": "The Policynumber Schema",
152 "default": "",
153 "examples": [
154 "123241239"
155 ],
156 "pattern": "^(.*)$"
157 },
158 "ledgerAccount": {
159 "$id": "#/properties/vendorInvoices/items/properties/ledgerAccount",
160 "type": "string",
161 "title": "The Ledgeraccount Schema",
162 "default": "",
163 "examples": [
164 "Commission Payable"
165 ],
166 "pattern": "^(.*)$"
167 },
168 "exchangeRate": {
169 "$id": "#/properties/vendorInvoices/items/properties/exchangeRate",
170 "type": "number",
171 "title": "The Exchangerate Schema",
172 "default": 0.0,
173 "examples": [
174 19.32
175 ]
176 },
177 "company": {
178 "$id": "#/properties/vendorInvoices/items/properties/company",
179 "type": "string",
180 "title": "The Company Schema",
181 "default": "",
182 "examples": [
183 "test"
184 ],
185 "pattern": "^(.*)$"
186 },
187 "branch": {
188 "$id": "#/properties/vendorInvoices/items/properties/branch",
189 "type": "string",
190 "title": "The Branch Schema",
191 "default": "",
192 "examples": [
193 "Head Office"
194 ],
195 "pattern": "^(.*)$"
196 },
197 "department": {
198 "$id": "#/properties/vendorInvoices/items/properties/department",
199 "type": "string",
200 "title": "The Department Schema",
201 "default": "",
202 "examples": [
203 "Accounts"
204 ],
205 "pattern": "^(.*)$"
206 },
207 "sourceRecordId": {
208 "$id": "#/properties/vendorInvoices/items/properties/sourceRecordId",
209 "type": "string",
210 "title": "The Sourcerecordid Schema",
211 "default": "",
212 "examples": [
213 "123123ertcbg"
214 ],
215 "pattern": "^(.*)$"
216 }
217 }
218 }
219 }
220 }
221 }
Captcha failing which prevents email from sending.
There is some problem with https://prod.json.systems/v1/documents:infer
You can try Submit default schema (Schema tab)
xxx=token
POST https://prod.json.systems/v1/documents:infer?key=xxx 500 ()
(index):1 Failed to load https://prod.json.systems/v1/documents:infer?key=xxx:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'https://jsonschema.net' is therefore not allowed access. The response had HTTP status code 500.
Schema is copying with line numbers.
This behavior corrupts the schema (where numbers as examples are present).
It would be nice to able to directly open a json schema by providing an url, for example:
https://jsonschema.net/?url=url_to_a_public_json_schema
This would be a very useful feature. The edit mode nicely shows the schema structure so it could be used for nicely visualizing existing schemas and experimenting with them.
When entering a very long string pattern, it expands the viewport beyond the browser width, requiring scrolling back and forth. The overflow should be hidden when not actively editing the field to avoid this. I suspect all the fields probably have this same issue, but I haven't encountered it yet.
Using the editor, I assign a minimum and maximum to a number field. If I take that generated schema and have the editor re-parse it, it fails to parse.
Steps to reproduce:
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "number"
}
}
}
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/root.json",
"type": "object",
"properties": {
"id": {
"$id": "#/properties/id",
"type": "number",
"minimum": 3.0,
"maximum": 8.0
}
}
}
Result: Right hand side shows error icon with "Ooops"
This has happened to me 8 times trying to use this tool.
If Im at the end of a line and entering data, or sometimes on a new line, but I tab and it simply wipes out everything Ive already entered, this is IMMENSLY frusterating, and literally makes the tool unusable for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.