-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: [PROD-11970] add docs to explain solution and workspace schema …
…validation
- Loading branch information
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Solution and workspace data validation | ||
|
||
When application is rendered, solution and workspace objects are validated against a schema created with [Zod](https://zod.dev/) library. If | ||
it contains some unknown keys, a warning will be displayed in browser console. For example, a typo in configuration keys - _subtype_ instead of _subType_: | ||
|
||
```yaml | ||
parameters: | ||
- id: 'parameter1' | ||
options: | ||
subtype: 'TABLE' | ||
``` | ||
will trigger this type of warning: _Parameter with id 'parameter1' contains unknown keys: 'subtype', please check your solution_. | ||
If your solution or workspace configuration contains some customized options, you can add its keys in arrays for custom options to avoid triggering warnings every time your web app is opened. | ||
- options in `parameters` section of the solution must be enumerated in `CUSTOM_SCENARIO_PARAMETERS_OPTIONS` array in [src/utils/schemas/custom/customSolutionOptions.js](../src/utils/schemas/custom/customSolutionOptions.js) | ||
- options in `parameterGroups` section of the solution must be enumerated in `CUSTOM_PARAMETER_GROUPS_OPTIONS` array in [src/utils/schemas/custom/customSolutionOptions.js](../src/utils/schemas/custom/customSolutionOptions.js) | ||
- options in `webApp` section of the workspace configuration must be enumerated in `CUSTOM_WEB_APP_OPTIONS` array in [src/utils/schemas/custom/customWorkspaceOptions.js](../src/utils/schemas/custom/customWorkspaceOptions.js) | ||
|
||
Example: | ||
|
||
_Solution.yaml_ | ||
|
||
```yaml | ||
parameters: | ||
- id: 'parameter2' | ||
options: | ||
customOption: 'option1' | ||
anotherCustomOption: 'option2' | ||
parameterGroups: | ||
- id: 'parameterGroup1' | ||
options: | ||
customOption: 'option1' | ||
``` | ||
|
||
_customSolutionOptions.js_ | ||
|
||
```javascript | ||
export const CUSTOM_SCENARIO_PARAMETERS_OPTIONS = ['customOption', 'anotherCustomOption']; | ||
export const CUSTOM_PARAMETER_GROUPS_OPTIONS = ['customOption']; | ||
``` |