Skip to content

Commit be57d46

Browse files
committed
BUGFIX: PHPStorm and other intelliJ IDEs show errors when using if-else conditions
1 parent 36bd5dd commit be57d46

File tree

2 files changed

+100
-80
lines changed

2 files changed

+100
-80
lines changed

NodeTypes.Schema.json

Lines changed: 76 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,104 +1161,100 @@
11611161
}
11621162
},
11631163
"defaultValueValidation": {
1164-
"if": {
1165-
"required": ["type"],
1166-
"properties": {
1167-
"type": {
1168-
"minLength": 1
1164+
"oneOf": [
1165+
{
1166+
"properties": {
1167+
"type": {
1168+
"type": "null"
1169+
}
11691170
}
1170-
}
1171-
},
1172-
"then": {
1173-
"allOf": [
1174-
{
1175-
"if": {
1176-
"properties": {
1177-
"type": {
1178-
"const": "string"
1179-
}
1180-
}
1181-
},
1182-
"then": {
1183-
"properties": {
1184-
"defaultValue": {
1185-
"type": "string"
1186-
}
1171+
},
1172+
{
1173+
"not": {
1174+
"properties": {
1175+
"type": {
1176+
"enum": [
1177+
"string",
1178+
"integer",
1179+
"number",
1180+
"boolean"
1181+
]
11871182
}
11881183
}
1189-
},
1190-
{
1191-
"if": {
1192-
"properties": {
1193-
"type": {
1194-
"const": "integer"
1195-
}
1196-
}
1184+
}
1185+
},
1186+
{
1187+
"required": [
1188+
"type"
1189+
],
1190+
"properties": {
1191+
"type": {
1192+
"const": "string"
11971193
},
1198-
"then": {
1199-
"properties": {
1200-
"defaultValue": {
1201-
"type": "integer"
1202-
}
1203-
}
1194+
"defaultValue": {
1195+
"type": [
1196+
"string",
1197+
"null"
1198+
]
12041199
}
1205-
},
1206-
{
1207-
"if": {
1208-
"properties": {
1209-
"type": {
1210-
"const": "boolean"
1211-
}
1212-
}
1200+
}
1201+
},
1202+
{
1203+
"required": [
1204+
"type"
1205+
],
1206+
"properties": {
1207+
"type": {
1208+
"const": "integer"
12131209
},
1214-
"then": {
1215-
"properties": {
1216-
"defaultValue": {
1217-
"type": "boolean"
1218-
}
1219-
}
1210+
"defaultValue": {
1211+
"type": [
1212+
"integer",
1213+
"null"
1214+
]
12201215
}
1221-
},
1222-
{
1223-
"if": {
1224-
"properties": {
1225-
"type": {
1226-
"const": "array"
1227-
}
1228-
}
1216+
}
1217+
},
1218+
{
1219+
"required": [
1220+
"type"
1221+
],
1222+
"properties": {
1223+
"type": {
1224+
"const": "number"
12291225
},
1230-
"then": {
1231-
"properties": {
1232-
"defaultValue": {
1233-
"type": "array"
1234-
}
1235-
}
1226+
"defaultValue": {
1227+
"type": [
1228+
"number",
1229+
"null"
1230+
]
12361231
}
1237-
},
1238-
{
1239-
"if": {
1240-
"properties": {
1241-
"type": {
1242-
"const": "number"
1243-
}
1244-
}
1232+
}
1233+
},
1234+
{
1235+
"required": [
1236+
"type"
1237+
],
1238+
"properties": {
1239+
"type": {
1240+
"const": "boolean"
12451241
},
1246-
"then": {
1247-
"properties": {
1248-
"defaultValue": {
1249-
"type": "number"
1250-
}
1251-
}
1242+
"defaultValue": {
1243+
"type": [
1244+
"boolean",
1245+
"null"
1246+
]
12521247
}
12531248
}
1254-
]
1255-
}
1249+
}
1250+
]
12561251
},
12571252
"defaultValueType": {
12581253
"type": [
12591254
"string",
12601255
"number",
12611256
"boolean",
1257+
"integer",
12621258
"null",
12631259
"array"
12641260
]

examples/NodeTypes.Editors.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ My.Vendor:Content.Editors:
4848

4949
textField:
5050
type: string
51+
defaultValue: 'foo'
5152
ui:
5253
inspector:
5354
editor: 'Neos.Neos/Inspector/Editors/TextFieldEditor'
@@ -75,6 +76,8 @@ My.Vendor:Content.Editors:
7576
icon: 'newspaper'
7677

7778
boolean:
79+
type: boolean
80+
defaultValue: true
7881
ui:
7982
inspector:
8083
editor: 'Neos.Neos/Inspector/Editors/BooleanEditor'
@@ -97,6 +100,27 @@ My.Vendor:Content.Editors:
97100
editorOptions:
98101
highlightingMode: htmlmixed
99102

103+
integer:
104+
type: integer
105+
defaultValue: 2
106+
ui:
107+
inspector:
108+
editor: 'Neos.Neos/Inspector/Editors/RangeEditor'
109+
editorOptions:
110+
min: 0
111+
max: 10
112+
113+
number:
114+
type: number
115+
defaultValue: 1.2
116+
ui:
117+
inspector:
118+
editor: 'Neos.Neos/Inspector/Editors/RangeEditor'
119+
editorOptions:
120+
min: 0
121+
max: 10
122+
step: 0.1
123+
100124
asset:
101125
type: Neos\Media\Domain\Model\Asset
102126
ui:

0 commit comments

Comments
 (0)