-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add schema validation docs (#748)
Co-authored-by: @Racer159 <wayne@defenseunicorns.com> Co-authored-by: Tristan Holaday <40547442+TristanHoladay@users.noreply.github.com>
- Loading branch information
1 parent
8232540
commit a696ffc
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
## Schema Validation | ||
|
||
When working with UDS configuration files, it can be useful to setup your IDE to know about the various schemas that UDS uses. | ||
|
||
The recommended method of validating schemas is by the use of `yaml-language-server` file headers: | ||
|
||
For `uds-bundle.yaml` | ||
```yaml | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/uds-cli/main/uds.schema.json | ||
``` | ||
|
||
For `zarf.yaml` | ||
```yaml | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/uds-cli/main/zarf.schema.json | ||
``` | ||
|
||
For `tasks.yaml` | ||
```yaml | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/defenseunicorns/uds-cli/main/tasks.schema.json | ||
``` | ||
|
||
This method works with both VSCode and Goland (Jetbrains IDEs). | ||
|
||
### Other IDE-specific Methods | ||
|
||
### VS Code | ||
|
||
To do this in VS Code you can install the [YAML Extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml) and add the following to your `settings.json` (pinning `main` to your UDS CLI version if desired): | ||
|
||
```json | ||
"yaml.schemas": { | ||
"https://raw.githubusercontent.com/defenseunicorns/uds-cli/main/uds.schema.json": "uds-bundle.yaml" | ||
}, | ||
``` | ||
|
||
#### Goland (Jetbrains IDEs) | ||
|
||
Use this method if you want to apply the schema to all YAML files in your project without modifying them. Open the IDE settings and navigate to `Languages & Frameworks` -> `Schemas and DTDs` -> `JSON Schema Mappings` and add a new schema using the "+" icon as shown below: | ||
|
||
![Goland Schema Mapping](.images/goland-json-schema.png) | ||
|
||
Don't forget to set the file path pattern for the JSON schema to apply to. |