Skip to content

Commit ed4497d

Browse files
committed
update json schema to allow array validations
1 parent 4b3f741 commit ed4497d

File tree

2 files changed

+72
-9
lines changed

2 files changed

+72
-9
lines changed

schemas/bashly.json

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,27 @@
7676
"validate": {
7777
"title": "validate",
7878
"description": "A validation function of the current positional argument\nhttps://bashly.dev/configuration/argument/#validate",
79-
"type": "string",
79+
"oneOf": [
80+
{
81+
"type": "string"
82+
},
83+
{
84+
"type": "array",
85+
"minItems": 1,
86+
"items": {
87+
"type": "string"
88+
}
89+
}
90+
],
8091
"examples": [
8192
"file_exists",
8293
"dir_exists",
8394
"integer",
84-
"non_empty"
95+
"non_empty",
96+
[
97+
"file_exists",
98+
"file_writable"
99+
]
85100
]
86101
},
87102
"unique": {
@@ -261,12 +276,27 @@
261276
"validate": {
262277
"title": "validate",
263278
"description": "A validation function of the current flag\nhttps://bashly.dev/configuration/flag/#validate",
264-
"type": "string",
279+
"oneOf": [
280+
{
281+
"type": "string"
282+
},
283+
{
284+
"type": "array",
285+
"minItems": 1,
286+
"items": {
287+
"type": "string"
288+
}
289+
}
290+
],
265291
"examples": [
266292
"file_exists",
267293
"dir_exists",
268294
"integer",
269-
"non_empty"
295+
"non_empty",
296+
[
297+
"file_exists",
298+
"file_writable"
299+
]
270300
]
271301
},
272302
"unique": {
@@ -337,12 +367,27 @@
337367
"validate": {
338368
"title": "validate",
339369
"description": "A validation function for the current environment variable\nhttps://bashly.dev/configuration/environment-variable/#validate",
340-
"type": "string",
370+
"oneOf": [
371+
{
372+
"type": "string"
373+
},
374+
{
375+
"type": "array",
376+
"minItems": 1,
377+
"items": {
378+
"type": "string"
379+
}
380+
}
381+
],
341382
"examples": [
342383
"file_exists",
343384
"dir_exists",
344385
"integer",
345-
"non_empty"
386+
"non_empty",
387+
[
388+
"file_exists",
389+
"file_writable"
390+
]
346391
]
347392
},
348393
"allowed": {

support/schema/bashly.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,18 @@ definitions:
7373
description: |-
7474
A validation function of the current positional argument
7575
https://bashly.dev/configuration/argument/#validate
76-
type: string
76+
oneOf:
77+
- type: string
78+
- type: array
79+
minItems: 1
80+
items:
81+
type: string
7782
examples:
7883
- file_exists
7984
- dir_exists
8085
- integer
8186
- non_empty
87+
- [file_exists, file_writable]
8288
unique:
8389
title: unique
8490
description: |-
@@ -239,12 +245,18 @@ definitions:
239245
description: |-
240246
A validation function of the current flag
241247
https://bashly.dev/configuration/flag/#validate
242-
type: string
248+
oneOf:
249+
- type: string
250+
- type: array
251+
minItems: 1
252+
items:
253+
type: string
243254
examples:
244255
- file_exists
245256
- dir_exists
246257
- integer
247258
- non_empty
259+
- [file_exists, file_writable]
248260
unique:
249261
title: unique
250262
description: |-
@@ -305,12 +317,18 @@ definitions:
305317
description: |-
306318
A validation function for the current environment variable
307319
https://bashly.dev/configuration/environment-variable/#validate
308-
type: string
320+
oneOf:
321+
- type: string
322+
- type: array
323+
minItems: 1
324+
items:
325+
type: string
309326
examples:
310327
- file_exists
311328
- dir_exists
312329
- integer
313330
- non_empty
331+
- [file_exists, file_writable]
314332
allowed:
315333
title: allowed
316334
description: |-

0 commit comments

Comments
 (0)