Skip to content

Commit

Permalink
docs: config validation (#80)
Browse files Browse the repository at this point in the history
Documentation for enabling config schema validation

---

### **Checklist**
- [x] Documentation updated (if needed)
- [x] Code conforms to style guidelines

---------

Signed-off-by: Roaa Sakr <romoh@microsoft.com>
  • Loading branch information
romoh authored and elainezhao1 committed Jan 23, 2025
1 parent 7540000 commit 57740ac
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions docs/imagecustomizer/how-to/vscode-schema-validation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Enabling VS Code Configuration Validation for Prism (Image Customizer)

This guide explains how to set up YAML validation in Visual Studio Code (VS
Code) for authoring image customization configurations.

## Prerequisites

- VS Code installed on your system.

## Steps to Enable Validation

### 1. Install the YAML Extension

Download and install [YAML VS Code
extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml).
This extension provides YAML validation and syntax highlighting.

### 2. Update VS Code Settings

Modify your VS Code `settings.json` to point to the schema corresponding to the
version of Prism you are using.

Add the following to your `settings.json` file after updating `<RELEASE>` and
`<SPECIFIC-FOLDER>`:

- `<SPECIFIC-FOLDER>` is the directory containing your image configs.
- `<RELEASE>` is the version of Image Customizer that you are using (e.g.: v0.8).

```json
"yaml.schemas": {
"https://raw.githubusercontent.com/microsoft/azure-linux-image-tools/release/<RELEASE>/toolkit/tools/imagecustomizerapi/schema.json": [
"<SPECIFIC-FOLDER>/**/*.yaml"
]
}
```

For example:

```json
"yaml.schemas": {
"https://raw.githubusercontent.com/microsoft/azure-linux-image-tools/release/v0.9/toolkit/tools/imagecustomizerapi/schema.json": [
"/home/test/image-configs/**/*.yaml"
]
}
```

### 3. Validate Configurations

Once configured, YAML files in the specified directory will automatically be
validated against the schema. This enables syntax highlighting for errors and
provides instant feedback while editing your configurations. It ensures your
YAML files are properly formatted and conform to the schema.

You’re now ready to go!

0 comments on commit 57740ac

Please sign in to comment.