Skip to content

Commit 5f7ff7f

Browse files
authored
Document #58
1 parent 26fd905 commit 5f7ff7f

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,34 @@ Flowpack:
187187
In case exceptions are thrown in the node creation of the template, because a node constraint was not met or the `type` field was not set, the creation of the childNode is aborted, but we continue with the node creation of the other left over parts of the template.
188188
It behaves similar with properties: In case a property value doesn't match its declared type the exception is logged, but we will try to continue with the next property.
189189

190+
# Commands
191+
192+
## Validate simple node templates
193+
194+
It might be tedious to validate that all your templates are working especially in a larger project. To validate the ones that are not dependent on data from the node creation dialog (less complex templates) you can utilize this command:
195+
196+
```sh
197+
flow nodetemplate:validate
198+
```
199+
200+
In case everything is okay it will succeed with `X NodeType templates validated.`.
201+
202+
But in case you either have a syntax error in your template or the template does not match the node structure (illegal properties) you will be warned:
203+
204+
```
205+
76 of 78 NodeType template validated. 2 could not be build standalone.
206+
207+
My.NodeType:Bing
208+
Property "someLegacyProperty" in NodeType "My.NodeType:Bing" | PropertyIgnoredException(Because property is not declared in NodeType. Got value `"bg-gray-100"`., 1685869035209)
209+
210+
My.NodeType:Bar (depends on "data" context)
211+
Configuration ""${data.aListOfThings}"" in "childNodes.pages.withItems" | RuntimeException(Type NULL is not iterable., 1685802354186)
212+
```
213+
214+
The standalone validation should detect errors and prevents editors having to deal with these errors at runtime.
215+
216+
For more complex templates, which are dependent on the node creation data, it is recommended to write separate tests. Currently, errors in templates depending on the data context will only be treated as warning, as they are probably not an issue at runtime.
217+
190218
## Create template from node subtree
191219

192220
When creating a more complex node template (to create multiple pages and content elements) it can be helpful to take the current node subtree from your workspace as reference.
@@ -196,7 +224,7 @@ For this case you can use the command:
196224
flow nodeTemplate:createFromNodeSubtree <nodeIdentifier>
197225
```
198226

199-
It will give you the output similar to the example above.
227+
It will give you the output similar to the yaml example above.
200228
References to Nodes and non-primitive property values are commented out in the YAML.
201229

202230
## More examples

0 commit comments

Comments
 (0)