Skip to content

Commit

Permalink
BUGFIX: PHPStorm and other intelliJ IDEs show errors when using if-el…
Browse files Browse the repository at this point in the history
…se conditions
  • Loading branch information
Sebobo committed Dec 11, 2024
1 parent 36bd5dd commit be57d46
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 80 deletions.
156 changes: 76 additions & 80 deletions NodeTypes.Schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1161,104 +1161,100 @@
}
},
"defaultValueValidation": {
"if": {
"required": ["type"],
"properties": {
"type": {
"minLength": 1
"oneOf": [
{
"properties": {
"type": {
"type": "null"
}
}
}
},
"then": {
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "string"
}
}
},
"then": {
"properties": {
"defaultValue": {
"type": "string"
}
},
{
"not": {
"properties": {
"type": {
"enum": [
"string",
"integer",
"number",
"boolean"
]
}
}
},
{
"if": {
"properties": {
"type": {
"const": "integer"
}
}
}
},
{
"required": [
"type"
],
"properties": {
"type": {
"const": "string"
},
"then": {
"properties": {
"defaultValue": {
"type": "integer"
}
}
"defaultValue": {
"type": [
"string",
"null"
]
}
},
{
"if": {
"properties": {
"type": {
"const": "boolean"
}
}
}
},
{
"required": [
"type"
],
"properties": {
"type": {
"const": "integer"
},
"then": {
"properties": {
"defaultValue": {
"type": "boolean"
}
}
"defaultValue": {
"type": [
"integer",
"null"
]
}
},
{
"if": {
"properties": {
"type": {
"const": "array"
}
}
}
},
{
"required": [
"type"
],
"properties": {
"type": {
"const": "number"
},
"then": {
"properties": {
"defaultValue": {
"type": "array"
}
}
"defaultValue": {
"type": [
"number",
"null"
]
}
},
{
"if": {
"properties": {
"type": {
"const": "number"
}
}
}
},
{
"required": [
"type"
],
"properties": {
"type": {
"const": "boolean"
},
"then": {
"properties": {
"defaultValue": {
"type": "number"
}
}
"defaultValue": {
"type": [
"boolean",
"null"
]
}
}
]
}
}
]
},
"defaultValueType": {
"type": [
"string",
"number",
"boolean",
"integer",
"null",
"array"
]
Expand Down
24 changes: 24 additions & 0 deletions examples/NodeTypes.Editors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ My.Vendor:Content.Editors:

textField:
type: string
defaultValue: 'foo'
ui:
inspector:
editor: 'Neos.Neos/Inspector/Editors/TextFieldEditor'
Expand Down Expand Up @@ -75,6 +76,8 @@ My.Vendor:Content.Editors:
icon: 'newspaper'

boolean:
type: boolean
defaultValue: true
ui:
inspector:
editor: 'Neos.Neos/Inspector/Editors/BooleanEditor'
Expand All @@ -97,6 +100,27 @@ My.Vendor:Content.Editors:
editorOptions:
highlightingMode: htmlmixed

integer:
type: integer
defaultValue: 2
ui:
inspector:
editor: 'Neos.Neos/Inspector/Editors/RangeEditor'
editorOptions:
min: 0
max: 10

number:
type: number
defaultValue: 1.2
ui:
inspector:
editor: 'Neos.Neos/Inspector/Editors/RangeEditor'
editorOptions:
min: 0
max: 10
step: 0.1

asset:
type: Neos\Media\Domain\Model\Asset
ui:
Expand Down

0 comments on commit be57d46

Please sign in to comment.