Skip to content

Commit e972cd2

Browse files
author
Hanseter
committed
Show default values in arrays
1 parent 7133324 commit e972cd2

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<modelVersion>4.0.0</modelVersion>
77
<groupId>com.github.hanseter</groupId>
88
<artifactId>json-properties-fx</artifactId>
9-
<version>2.0.10</version>
9+
<version>2.0.11</version>
1010

1111
<packaging>bundle</packaging>
1212
<name>JSON Properties Editor Fx</name>

src/main/kotlin/com/github/hanseter/json/editor/controls/ArrayControl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class ArrayControl(
7777

7878
val subArray = subArray
7979
val rawValues = model.rawValue
80-
val values = rawValues as? JSONArray
80+
val values = rawValues as? JSONArray ?: model.defaultValue
8181
if (rawValues != JSONObject.NULL && values != null) {
8282
removeChildControls(values)
8383
addChildControls(values)

src/test/resources/DefaultObjectsSchema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"properties": {
55
"object": {
66
"type": "object",
7-
"default": {},
7+
"default": {"a": "Hello World"},
88
"properties": {
99
"a": {
1010
"type": "string"
@@ -22,6 +22,7 @@
2222
}
2323
}
2424
},
25+
"default": [{"a": "Hello World"},{"a": "Good Bye World"}]
2526
}
2627
}
2728
}

0 commit comments

Comments
 (0)