Skip to content

Commit f2d40be

Browse files
committed
Merge branch 'recursive-schemas'
2 parents 5287b68 + be5d196 commit f2d40be

File tree

20 files changed

+1736
-1987
lines changed

20 files changed

+1736
-1987
lines changed

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,14 @@ JSON Editor supports schema references to external URLs and local definitions.
373373
}
374374
```
375375

376-
Local references must point to the `definitions` object of the root node of the schema and can't be nested.
377-
So, both `#/customkey/name` and `#/definitions/name/first` will throw an exception.
376+
Local references must point to the `definitions` object of the root node of the schema.
377+
So, `#/customkey/name` will throw an exception.
378378

379379
If loading an external url via Ajax, the url must either be on the same domain or return the correct HTTP cross domain headers.
380380
If your URLs don't meet this requirement, you can pass in the references to JSON Editor during initialization (see Usage section above).
381381

382+
Self-referential $refs are supported. Check out `examples/recursive.html` for usage examples.
383+
382384
### hyper-schema links
383385

384386
The `links` keyword from the hyper-schema specification can be used to add links to related documents.
@@ -456,6 +458,26 @@ So, the final order of properties in the form (and in returned JSON data) will b
456458
3. prop1 (order 1000)
457459
4. prop3 (order 1001)
458460

461+
### Default Properties
462+
463+
The default behavior of JSON Editor is to include all object properties defined with the `properties` keyword.
464+
465+
To override this behaviour, you can use the keyword `defaultProperties` to set which ones are included:
466+
467+
```json
468+
{
469+
"type": "object",
470+
"properties": {
471+
"name": {"type": "string"},
472+
"age": {"type": "integer"}
473+
},
474+
"defaultProperties": ["name"]
475+
}
476+
```
477+
478+
Now, only the `name` property above will be included by default. You can use the "Object Properties" button
479+
to add the "age" property back in.
480+
459481
### format
460482

461483
JSON Editor supports many different formats for schemas of type `string`. They will work with schemas of type `integer` and `number` as well, but some formats may produce weird results.

demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ <h2>Code</h2>
158158
},
159159
age: {
160160
type: "integer",
161-
default: 24,
161+
default: 25,
162162
minimum: 18,
163163
maximum: 99
164164
},

0 commit comments

Comments
 (0)