Skip to content

Commit 319cf84

Browse files
Merge pull request #32
Add JSON schema for configuration validation and include schema references in relevant files
2 parents 09dcec0 + 903ba33 commit 319cf84

File tree

3 files changed

+159
-0
lines changed

3 files changed

+159
-0
lines changed

.github/preview-updater.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/TheDragonCode/preview-updater/refs/heads/main/resources/schema.json
2+
13
image:
24
parameters:
35
packageManager: 'none'

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Create `.github/preview-updater.yml` (or provide your own path via `configPath`)
7171
All fields are optional—omitted ones fall back to defaults.
7272

7373
```yaml
74+
# yaml-language-server: $schema=https://raw.githubusercontent.com/TheDragonCode/preview-updater/refs/heads/main/resources/schema.json
75+
7476
path:
7577
readme: README.md # Target file to update
7678

resources/schema.json

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "https://raw.githubusercontent.com/TheDragonCode/preview-updater/refs/heads/main/resources/schema.json",
4+
"type": "object",
5+
"additionalProperties": false,
6+
"properties": {
7+
"path": {
8+
"type": "object",
9+
"additionalProperties": false,
10+
"properties": {
11+
"readme": {
12+
"type": "string",
13+
"description": "Target README file where the banner will be inserted",
14+
"default": "README.md"
15+
}
16+
}
17+
},
18+
"image": {
19+
"type": "object",
20+
"additionalProperties": false,
21+
"properties": {
22+
"url": {
23+
"type": "string",
24+
"description": "Banner generation service URL",
25+
"default": "https://banners.beyondco.de/{title}.png"
26+
},
27+
"parameters": {
28+
"type": "object",
29+
"additionalProperties": false,
30+
"properties": {
31+
"pattern": {
32+
"type": "string",
33+
"default": "topography"
34+
},
35+
"style": {
36+
"type": "string",
37+
"default": "style_2"
38+
},
39+
"fontSize": {
40+
"type": "string",
41+
"default": "100px"
42+
},
43+
"icon": {
44+
"type": "string",
45+
"default": "code"
46+
},
47+
"packageManager": {
48+
"description": "Package manager name. Reserved values: composer | npm | yarn | auto | none",
49+
"anyOf": [
50+
{
51+
"type": "string",
52+
"enum": ["composer", "npm", "yarn", "auto", "none"]
53+
},
54+
{
55+
"type": "string"
56+
}
57+
],
58+
"default": "auto"
59+
},
60+
"packageName": {
61+
"type": "string",
62+
"description": "Package name. By default taken from composer.json or package.json"
63+
},
64+
"packageGlobal": {
65+
"type": "boolean",
66+
"description": "Add prefix for global installation",
67+
"default": false
68+
},
69+
"title": {
70+
"type": "string",
71+
"description": "Banner title. The repository name is used by default"
72+
},
73+
"description": {
74+
"type": "string",
75+
"description": "Package description. The repository description is used by default"
76+
}
77+
}
78+
}
79+
}
80+
},
81+
"repository": {
82+
"type": "object",
83+
"additionalProperties": false,
84+
"properties": {
85+
"commit": {
86+
"type": "object",
87+
"additionalProperties": false,
88+
"properties": {
89+
"branch": {
90+
"type": "string",
91+
"description": "Branch name for the commit",
92+
"default": "preview-{random}"
93+
},
94+
"title": {
95+
"type": "string",
96+
"description": "Commit title",
97+
"default": "docs(preview): Update preview"
98+
},
99+
"body": {
100+
"type": "string",
101+
"description": "Commit text"
102+
},
103+
"author": {
104+
"type": "object",
105+
"additionalProperties": false,
106+
"properties": {
107+
"name": {
108+
"type": "string",
109+
"description": "Commit author name",
110+
"default": "github-actions"
111+
},
112+
"email": {
113+
"type": "string",
114+
"description": "Commit author email",
115+
"default": "github-actions@github.com"
116+
}
117+
}
118+
}
119+
}
120+
},
121+
"pullRequest": {
122+
"type": "object",
123+
"additionalProperties": false,
124+
"properties": {
125+
"title": {
126+
"type": "string",
127+
"description": "Pull request title",
128+
"default": "Update preview"
129+
},
130+
"body": {
131+
"type": "string",
132+
"description": "Pull request text"
133+
},
134+
"assignees": {
135+
"type": "array",
136+
"items": {
137+
"type": "string"
138+
},
139+
"description": "Assignees list",
140+
"default": []
141+
},
142+
"labels": {
143+
"type": "array",
144+
"items": {
145+
"type": "string"
146+
},
147+
"description": "Labels list",
148+
"default": []
149+
}
150+
}
151+
}
152+
}
153+
}
154+
}
155+
}

0 commit comments

Comments
 (0)