Skip to content

Commit b3fb7eb

Browse files
authored
Merge pull request #29 from grafana/28-json-schema-refinements
JSON schema refinements
2 parents b902953 + 3111757 commit b3fb7eb

12 files changed

+853
-87
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ go-jsonschema -p k6registry --only-models -o registry_gen.go docs/registry.schem
5555
The example registry can be found in [example.yaml] file, the documentation ([registry.md], [README.md]) must be updated after modification.
5656

5757
```bash
58+
go run ./cmd/k6registry --lint docs/example.yaml > docs/example.json
5859
mdcode update docs/registry.md
5960
mdcode update README.md
6061
```
@@ -147,5 +148,5 @@ Requires
147148
## legacy - Convert legacy registry
148149

149150
```bash
150-
go run ./cmd/k6registry . --legacy | yq '.[]|= pick(["module","description","official","cloud","imports","outputs","repo"])|sort_by(.module)' > ./docs/legacy.yaml
151+
go run ./cmd/k6registry . --legacy | yq '.[]|= pick(["module","description","tier","product","imports","outputs","repo"])|sort_by(.module)' > ./docs/legacy.yaml
151152
```

README.md

Lines changed: 320 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,341 @@ Check [k6 Extension Registry Concept](docs/registry.md) for information on desig
1313
description: Web-based metrics dashboard for k6
1414
outputs:
1515
- dashboard
16-
official: true
16+
tier: official
1717

1818
- module: github.com/grafana/xk6-sql
1919
description: Load test SQL Servers
2020
imports:
2121
- k6/x/sql
22-
cloud: true
23-
official: true
22+
tier: official
23+
product: ["cloud", "oss"]
2424

2525
- module: github.com/grafana/xk6-disruptor
2626
description: Inject faults to test
2727
imports:
2828
- k6/x/disruptor
29-
official: true
29+
tier: official
3030

3131
- module: github.com/szkiba/xk6-faker
3232
description: Generate random fake data
3333
imports:
3434
- k6/x/faker
3535
```
3636
37+
<details>
38+
<summary><b>Example registry</b></summary>
39+
40+
Registry generated from the source above.
41+
42+
```json file=docs/example.json
43+
[
44+
{
45+
"description": "Web-based metrics dashboard for k6",
46+
"module": "github.com/grafana/xk6-dashboard",
47+
"outputs": [
48+
"dashboard"
49+
],
50+
"product": [
51+
"oss"
52+
],
53+
"repo": {
54+
"description": "A k6 extension that makes k6 metrics available on a web-based dashboard.",
55+
"homepage": "https://github.com/grafana/xk6-dashboard",
56+
"license": "AGPL-3.0",
57+
"name": "xk6-dashboard",
58+
"owner": "grafana",
59+
"public": true,
60+
"stars": 320,
61+
"topics": [
62+
"xk6",
63+
"xk6-official",
64+
"xk6-output-dashboard"
65+
],
66+
"url": "https://github.com/grafana/xk6-dashboard",
67+
"versions": [
68+
"v0.7.5",
69+
"v0.7.4",
70+
"v0.7.3",
71+
"v0.7.3-alpha.1",
72+
"v0.7.2",
73+
"v0.7.1",
74+
"v0.7.0",
75+
"v0.7.0-apha.3",
76+
"v0.7.0-alpha.5",
77+
"v0.7.0-alpha.4",
78+
"v0.7.0-alpha.3",
79+
"v0.7.0-alpha.2",
80+
"v0.7.0-alpha.1",
81+
"v0.6.1",
82+
"v0.6.0",
83+
"v0.5.5",
84+
"v0.5.4",
85+
"v0.5.3",
86+
"v0.5.2",
87+
"v0.5.1",
88+
"v0.5.0",
89+
"v0.4.4",
90+
"v0.4.3",
91+
"v0.4.2",
92+
"v0.4.1",
93+
"v0.4.0",
94+
"v0.3.2",
95+
"v0.3.1",
96+
"v0.3.0",
97+
"v0.2.0",
98+
"v0.1.3",
99+
"v0.1.2",
100+
"v0.1.1",
101+
"v0.1.0"
102+
]
103+
},
104+
"tier": "official"
105+
},
106+
{
107+
"description": "Load test SQL Servers",
108+
"imports": [
109+
"k6/x/sql"
110+
],
111+
"module": "github.com/grafana/xk6-sql",
112+
"product": [
113+
"cloud",
114+
"oss"
115+
],
116+
"repo": {
117+
"description": "k6 extension to load test RDBMSs (PostgreSQL, MySQL, MS SQL and SQLite3)",
118+
"homepage": "https://github.com/grafana/xk6-sql",
119+
"license": "Apache-2.0",
120+
"name": "xk6-sql",
121+
"owner": "grafana",
122+
"public": true,
123+
"stars": 102,
124+
"topics": [
125+
"k6",
126+
"sql",
127+
"xk6"
128+
],
129+
"url": "https://github.com/grafana/xk6-sql",
130+
"versions": [
131+
"v0.4.0",
132+
"v0.3.0",
133+
"v0.2.1",
134+
"v0.2.0",
135+
"v0.1.1",
136+
"v0.1.0",
137+
"v0.0.1"
138+
]
139+
},
140+
"tier": "official"
141+
},
142+
{
143+
"description": "Inject faults to test",
144+
"imports": [
145+
"k6/x/disruptor"
146+
],
147+
"module": "github.com/grafana/xk6-disruptor",
148+
"product": [
149+
"oss"
150+
],
151+
"repo": {
152+
"description": "Extension for injecting faults into k6 tests",
153+
"homepage": "https://k6.io/docs/javascript-api/xk6-disruptor/",
154+
"license": "AGPL-3.0",
155+
"name": "xk6-disruptor",
156+
"owner": "grafana",
157+
"public": true,
158+
"stars": 87,
159+
"topics": [
160+
"chaos-engineering",
161+
"fault-injection",
162+
"k6",
163+
"testing",
164+
"xk6"
165+
],
166+
"url": "https://github.com/grafana/xk6-disruptor",
167+
"versions": [
168+
"v0.3.11",
169+
"v0.3.10",
170+
"v0.3.9",
171+
"v0.3.8",
172+
"v0.3.7",
173+
"v0.3.6",
174+
"v0.3.5",
175+
"v0.3.5-rc2",
176+
"v0.3.5-rc1",
177+
"v0.3.4",
178+
"v0.3.3",
179+
"v0.3.2",
180+
"v0.3.1",
181+
"v0.3.0",
182+
"v0.2.1",
183+
"v0.2.0",
184+
"v0.1.3",
185+
"v0.1.2",
186+
"v0.1.1",
187+
"v0.1.0"
188+
]
189+
},
190+
"tier": "official"
191+
},
192+
{
193+
"description": "Generate random fake data",
194+
"imports": [
195+
"k6/x/faker"
196+
],
197+
"module": "github.com/szkiba/xk6-faker",
198+
"product": [
199+
"oss"
200+
],
201+
"repo": {
202+
"description": "Random fake data generator for k6.",
203+
"homepage": "http://ivan.szkiba.hu/xk6-faker/",
204+
"license": "AGPL-3.0",
205+
"name": "xk6-faker",
206+
"owner": "szkiba",
207+
"public": true,
208+
"stars": 49,
209+
"topics": [
210+
"xk6",
211+
"xk6-javascript-k6-x-faker"
212+
],
213+
"url": "https://github.com/szkiba/xk6-faker",
214+
"versions": [
215+
"v0.3.0",
216+
"v0.3.0-alpha.1",
217+
"v0.2.2",
218+
"v0.2.1",
219+
"v0.2.0",
220+
"v0.1.0"
221+
]
222+
},
223+
"tier": "community"
224+
},
225+
{
226+
"description": "A modern load testing tool, using Go and JavaScript",
227+
"module": "go.k6.io/k6",
228+
"product": [
229+
"cloud",
230+
"oss"
231+
],
232+
"repo": {
233+
"description": "A modern load testing tool, using Go and JavaScript - https://k6.io",
234+
"homepage": "https://github.com/grafana/k6",
235+
"license": "AGPL-3.0",
236+
"name": "k6",
237+
"owner": "grafana",
238+
"public": true,
239+
"stars": 24184,
240+
"topics": [
241+
"es6",
242+
"go",
243+
"golang",
244+
"hacktoberfest",
245+
"javascript",
246+
"load-generator",
247+
"load-testing",
248+
"performance"
249+
],
250+
"url": "https://github.com/grafana/k6",
251+
"versions": [
252+
"v0.53.0",
253+
"v0.52.0",
254+
"v0.51.0",
255+
"v0.50.0",
256+
"v0.49.0",
257+
"v0.48.0",
258+
"v0.47.0",
259+
"v0.46.0",
260+
"v0.45.1",
261+
"v0.45.0",
262+
"v0.44.1",
263+
"v0.44.0",
264+
"v0.43.1",
265+
"v0.43.0",
266+
"v0.42.0",
267+
"v0.41.0",
268+
"v0.40.0",
269+
"v0.39.0",
270+
"v0.38.3",
271+
"v0.38.2",
272+
"v0.38.1",
273+
"v0.38.0",
274+
"v0.37.0",
275+
"v0.36.0",
276+
"v0.35.0",
277+
"v0.34.1",
278+
"v0.34.0",
279+
"v0.33.0",
280+
"v0.32.0",
281+
"v0.31.1",
282+
"v0.31.0",
283+
"v0.30.0",
284+
"v0.29.0",
285+
"v0.28.0",
286+
"v0.27.1",
287+
"v0.27.0",
288+
"v0.26.2",
289+
"v0.26.1",
290+
"v0.26.0",
291+
"v0.25.1",
292+
"v0.25.0",
293+
"v0.24.0",
294+
"v0.23.1",
295+
"v0.23.0",
296+
"v0.22.1",
297+
"v0.22.0",
298+
"v0.21.1",
299+
"v0.21.0",
300+
"v0.20.0",
301+
"v0.19.0",
302+
"v0.18.2",
303+
"v0.18.1",
304+
"v0.18.0",
305+
"v0.17.2",
306+
"v0.17.1",
307+
"v0.17.0",
308+
"v0.16.0",
309+
"v0.15.0",
310+
"v0.14.0",
311+
"v0.13.0",
312+
"v0.12.2",
313+
"v0.12.1",
314+
"v0.11.0",
315+
"v0.10.0",
316+
"v0.9.3",
317+
"v0.9.2",
318+
"v0.9.1",
319+
"v0.9.0",
320+
"v0.8.5",
321+
"v0.8.4",
322+
"v0.8.3",
323+
"v0.8.2",
324+
"v0.8.1",
325+
"v0.8.0",
326+
"v0.7.0",
327+
"v0.6.0",
328+
"v0.5.2",
329+
"v0.5.1",
330+
"v0.5.0",
331+
"v0.4.5",
332+
"v0.4.4",
333+
"v0.4.3",
334+
"v0.4.2",
335+
"v0.4.1",
336+
"v0.4.0",
337+
"v0.3.0",
338+
"v0.2.1",
339+
"v0.2.0",
340+
"v0.0.2",
341+
"v0.0.1"
342+
]
343+
},
344+
"tier": "official"
345+
}
346+
]
347+
```
348+
349+
</details>
350+
37351
A [legacy extension registry](docs/legacy.yaml) converted to the new format is also a good example.
38352

39353
## Install
@@ -82,11 +396,11 @@ changed | `true` if the output has changed compared to `ref`, otherwise `false`
82396

83397
```yaml
84398
- name: Generate registry in JSON format
85-
uses: grafana/[email protected].4
399+
uses: grafana/[email protected].10
86400
with:
87401
in: "registry.yaml"
88402
out: "registry.json"
89-
filter: "."
403+
lint: "true"
90404
```
91405
92406
## CLI

0 commit comments

Comments
 (0)