Skip to content

Commit d0ac1ae

Browse files
Copilotpelikhan
andcommitted
Add YAML schema validation documentation to VSCode setup guide
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent e6bbf52 commit d0ac1ae

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

‎docs/src/content/docs/setup/vscode.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,59 @@ Configure VS Code to automatically compile workflows when files change. Create o
6363
```
6464

6565
The task starts automatically when you open a Markdown file under `.github/workflows/`. If it doesn't start, use the command palette (`Ctrl + Shift + P`) and run `Tasks: Manage Automatic Tasks` to enable automatic task execution.
66+
67+
## YAML Schema Validation
68+
69+
The repository is configured to provide real-time validation and autocomplete for workflow frontmatter using the [RedHat YAML extension](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml).
70+
71+
### Features
72+
73+
- **Real-time validation**: Frontmatter fields are validated as you type against the comprehensive workflow schema
74+
- **Autocomplete**: Get intelligent suggestions for field names and values
75+
- **Hover documentation**: See descriptions and examples for each field by hovering over it
76+
- **Error highlighting**: Invalid configurations are highlighted with descriptive error messages
77+
78+
### Setup
79+
80+
1. **Install the extension**: When you open the repository, VS Code will recommend installing the RedHat YAML extension. Accept the recommendation or install it manually from the Extensions marketplace.
81+
82+
2. **Automatic configuration**: The schema is automatically applied to all `.md` files in `.github/workflows/` via `.vscode/settings.json`:
83+
84+
```json
85+
{
86+
"yaml.schemas": {
87+
"./pkg/parser/schemas/main_workflow_schema.json": ".github/workflows/*.md"
88+
}
89+
}
90+
```
91+
92+
### Usage
93+
94+
When editing workflow markdown files (`.md` files in `.github/workflows/`), the YAML frontmatter block is validated:
95+
96+
```yaml
97+
---
98+
name: My Workflow # ✓ Valid string
99+
on: push # ✓ Valid trigger
100+
permissions:
101+
contents: read # ✓ Valid permission level
102+
engine: copilot # ✓ Valid engine
103+
invalid-field: x # ✗ Error: Unknown property
104+
---
105+
```
106+
107+
The extension validates:
108+
- Required fields (e.g., `on` trigger is required)
109+
- Field types (strings, numbers, booleans, objects, arrays)
110+
- Enum values (e.g., `engine` must be one of: `copilot`, `claude`, `codex`, `custom`)
111+
- Nested object structures
112+
- Complex conditional logic
113+
114+
### Troubleshooting
115+
116+
If schema validation isn't working:
117+
118+
1. **Check extension is installed**: Look for "YAML" in your installed extensions list
119+
2. **Reload VS Code**: Use `Ctrl+Shift+P` → "Developer: Reload Window"
120+
3. **Verify file pattern**: Schema only applies to `.md` files in `.github/workflows/`
121+
4. **Check YAML frontmatter**: Ensure your frontmatter is wrapped in `---` delimiters

0 commit comments

Comments
 (0)