Skip to content

Commit b61600d

Browse files
authored
Merge pull request #564 from DannyBen/update/schema
Update JSON schema to include `command.variables`
2 parents b2f9a2b + 5b007fe commit b61600d

File tree

2 files changed

+123
-20
lines changed

2 files changed

+123
-20
lines changed

schemas/bashly.json

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"title": "allowed",
5757
"description": "Valid values of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#allowed",
5858
"type": "array",
59-
"minLength": 1,
59+
"minItems": 1,
6060
"uniqueItems": true,
6161
"items": {
6262
"description": "A valid value of the current positional argument",
@@ -193,7 +193,7 @@
193193
"title": "allowed",
194194
"description": "Valid values of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#allowed",
195195
"type": "array",
196-
"minLength": 1,
196+
"minItems": 1,
197197
"uniqueItems": true,
198198
"items": {
199199
"description": "A valid value of the current positional argument",
@@ -208,7 +208,7 @@
208208
"title": "conflicts",
209209
"description": "Mutually exclusive flags of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#conflicts",
210210
"type": "array",
211-
"minLength": 1,
211+
"minItems": 1,
212212
"uniqueItems": true,
213213
"items": {
214214
"description": "The long form of the required flag",
@@ -223,7 +223,7 @@
223223
"title": "needs",
224224
"description": "Additional flags required by the current flag\nhttps://bashly.dannyb.co/configuration/flag/#needs",
225225
"type": "array",
226-
"minLength": 1,
226+
"minItems": 1,
227227
"uniqueItems": true,
228228
"items": {
229229
"description": "The long form of the required flag",
@@ -238,7 +238,7 @@
238238
"title": "completions",
239239
"description": "Completions of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#completions",
240240
"type": "array",
241-
"minLength": 1,
241+
"minItems": 1,
242242
"uniqueItems": true,
243243
"items": {
244244
"description": "A completion of the current flag",
@@ -349,7 +349,7 @@
349349
"title": "allowed",
350350
"description": "Valid values of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#allowed",
351351
"type": "array",
352-
"minLength": 1,
352+
"minItems": 1,
353353
"uniqueItems": true,
354354
"items": {
355355
"description": "A valid value of the current environment variable",
@@ -380,6 +380,50 @@
380380
},
381381
"additionalProperties": false
382382
},
383+
"variable": {
384+
"title": "variable",
385+
"description": "A global bash variable\nhttps://bashly.dannyb.co/configuration/command/#variables",
386+
"type": "object",
387+
"required": [
388+
"name"
389+
],
390+
"properties": {
391+
"name": {
392+
"title": "name",
393+
"description": "A name for the current variable",
394+
"type": "string",
395+
"minLength": 1,
396+
"examples": [
397+
"output_dir"
398+
]
399+
},
400+
"value": {
401+
"title": "value",
402+
"description": "A value for the current variable",
403+
"examples": [
404+
"output_dir",
405+
[
406+
"development",
407+
"production"
408+
],
409+
{
410+
"verbosity": 3,
411+
"debug": true
412+
}
413+
]
414+
}
415+
},
416+
"patternProperties": {
417+
"^x_.": {
418+
"title": "custom property",
419+
"description": "A custom property of any type",
420+
"examples": [
421+
"Anything"
422+
]
423+
}
424+
},
425+
"additionalProperties": false
426+
},
383427
"name-property": {
384428
"title": "name",
385429
"description": "A name of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#name",
@@ -430,8 +474,8 @@
430474
"title": "args",
431475
"description": "Arguments of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#args",
432476
"type": "array",
433-
"uniqueItems": true,
434477
"minItems": 1,
478+
"uniqueItems": true,
435479
"items": {
436480
"$ref": "#/definitions/argument"
437481
}
@@ -440,8 +484,8 @@
440484
"title": "flags",
441485
"description": "Flags of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#flags",
442486
"type": "array",
443-
"uniqueItems": true,
444487
"minItems": 1,
488+
"uniqueItems": true,
445489
"items": {
446490
"$ref": "#/definitions/flag"
447491
}
@@ -450,6 +494,7 @@
450494
"title": "commands",
451495
"description": "Subcommands of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#commands",
452496
"type": "array",
497+
"minItems": 1,
453498
"uniqueItems": true,
454499
"items": {
455500
"$ref": "#/definitions/command-property"
@@ -485,11 +530,22 @@
485530
"title": "environment variables",
486531
"description": "Environment variables of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable",
487532
"type": "array",
533+
"minItems": 1,
488534
"uniqueItems": true,
489535
"items": {
490536
"$ref": "#/definitions/environment-variable"
491537
}
492538
},
539+
"variables-property": {
540+
"title": "variables",
541+
"description": "Bash variables for the current application\nhttps://bashly.dannyb.co/configuration/command/#variables",
542+
"type": "array",
543+
"minItems": 1,
544+
"uniqueItems": true,
545+
"items": {
546+
"$ref": "#/definitions/variable"
547+
}
548+
},
493549
"examples-property": {
494550
"title": "examples",
495551
"oneOf": [
@@ -583,7 +639,7 @@
583639
"title": "completions",
584640
"description": "Completions of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#completions",
585641
"type": "array",
586-
"minLength": 1,
642+
"minItems": 1,
587643
"uniqueItems": true,
588644
"items": {
589645
"description": "A completion of the current script or sub-command",
@@ -647,7 +703,7 @@
647703
{
648704
"description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency",
649705
"type": "array",
650-
"minLength": 1,
706+
"minItems": 1,
651707
"uniqueItems": true,
652708
"items": {
653709
"description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency",
@@ -806,6 +862,9 @@
806862
"environment_variables": {
807863
"$ref": "#/definitions/environment-variables-property"
808864
},
865+
"variables": {
866+
"$ref": "#/definitions/variables-property"
867+
},
809868
"examples": {
810869
"$ref": "#/definitions/examples-property"
811870
},
@@ -880,6 +939,9 @@
880939
"environment_variables": {
881940
"$ref": "#/definitions/environment-variables-property"
882941
},
942+
"variables": {
943+
"$ref": "#/definitions/variables-property"
944+
},
883945
"examples": {
884946
"$ref": "#/definitions/examples-property"
885947
},

support/schema/bashly.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ definitions:
5353
Valid values of the current positional argument
5454
https://bashly.dannyb.co/configuration/argument/#allowed
5555
type: array
56-
minLength: 1
56+
minItems: 1
5757
uniqueItems: true
5858
items:
5959
description: A valid value of the current positional argument
@@ -172,7 +172,7 @@ definitions:
172172
Valid values of the current flag
173173
https://bashly.dannyb.co/configuration/flag/#allowed
174174
type: array
175-
minLength: 1
175+
minItems: 1
176176
uniqueItems: true
177177
items:
178178
description: A valid value of the current positional argument
@@ -186,7 +186,7 @@ definitions:
186186
Mutually exclusive flags of the current flag
187187
https://bashly.dannyb.co/configuration/flag/#conflicts
188188
type: array
189-
minLength: 1
189+
minItems: 1
190190
uniqueItems: true
191191
items:
192192
description: The long form of the required flag
@@ -200,7 +200,7 @@ definitions:
200200
Additional flags required by the current flag
201201
https://bashly.dannyb.co/configuration/flag/#needs
202202
type: array
203-
minLength: 1
203+
minItems: 1
204204
uniqueItems: true
205205
items:
206206
description: The long form of the required flag
@@ -214,7 +214,7 @@ definitions:
214214
Completions of the current flag
215215
https://bashly.dannyb.co/configuration/flag/#completions
216216
type: array
217-
minLength: 1
217+
minItems: 1
218218
uniqueItems: true
219219
items:
220220
description: A completion of the current flag
@@ -317,7 +317,7 @@ definitions:
317317
Valid values of the current environment variable
318318
https://bashly.dannyb.co/configuration/environment-variable/#allowed
319319
type: array
320-
minLength: 1
320+
minItems: 1
321321
uniqueItems: true
322322
items:
323323
description: A valid value of the current environment variable
@@ -335,6 +335,31 @@ definitions:
335335
- ~/config.ini
336336
patternProperties: *custom-properties
337337
additionalProperties: false
338+
variable:
339+
title: variable
340+
description: |-
341+
A global bash variable
342+
https://bashly.dannyb.co/configuration/command/#variables
343+
type: object
344+
required:
345+
- name
346+
properties:
347+
name:
348+
title: name
349+
description: A name for the current variable
350+
type: string
351+
minLength: 1
352+
examples:
353+
- output_dir
354+
value:
355+
title: value
356+
description: A value for the current variable
357+
examples:
358+
- output_dir
359+
- [development, production]
360+
- { verbosity: 3, debug: true }
361+
patternProperties: *custom-properties
362+
additionalProperties: false
338363
name-property:
339364
title: name
340365
description: |-
@@ -382,8 +407,8 @@ definitions:
382407
Arguments of the current script or sub-command
383408
https://bashly.dannyb.co/configuration/command/#args
384409
type: array
385-
uniqueItems: true
386410
minItems: 1
411+
uniqueItems: true
387412
items:
388413
$ref: '#/definitions/argument'
389414
flags-property:
@@ -392,8 +417,8 @@ definitions:
392417
Flags of the current script or sub-command
393418
https://bashly.dannyb.co/configuration/command/#flags
394419
type: array
395-
uniqueItems: true
396420
minItems: 1
421+
uniqueItems: true
397422
items:
398423
$ref: '#/definitions/flag'
399424
commands-property:
@@ -402,6 +427,7 @@ definitions:
402427
Subcommands of the current script or sub-command
403428
https://bashly.dannyb.co/configuration/command/#commands
404429
type: array
430+
minItems: 1
405431
uniqueItems: true
406432
items:
407433
$ref: '#/definitions/command-property'
@@ -432,9 +458,20 @@ definitions:
432458
Environment variables of the current application
433459
https://bashly.dannyb.co/configuration/environment-variable/#environment-variable
434460
type: array
461+
minItems: 1
435462
uniqueItems: true
436463
items:
437464
$ref: '#/definitions/environment-variable'
465+
variables-property:
466+
title: variables
467+
description: |-
468+
Bash variables for the current application
469+
https://bashly.dannyb.co/configuration/command/#variables
470+
type: array
471+
minItems: 1
472+
uniqueItems: true
473+
items:
474+
$ref: '#/definitions/variable'
438475
examples-property:
439476
title: examples
440477
oneOf:
@@ -520,7 +557,7 @@ definitions:
520557
Completions of the current script or sub-command
521558
https://bashly.dannyb.co/configuration/command/#completions
522559
type: array
523-
minLength: 1
560+
minItems: 1
524561
uniqueItems: true
525562
items:
526563
description: A completion of the current script or sub-command
@@ -583,7 +620,7 @@ definitions:
583620
Dependencies of the current script or sub-command
584621
https://bashly.dannyb.co/configuration/dependency/#dependency
585622
type: array
586-
minLength: 1
623+
minItems: 1
587624
uniqueItems: true
588625
items:
589626
description: |-
@@ -708,6 +745,8 @@ definitions:
708745
$ref: '#/definitions/sub-command-default-property'
709746
environment_variables:
710747
$ref: '#/definitions/environment-variables-property'
748+
variables:
749+
$ref: '#/definitions/variables-property'
711750
examples:
712751
$ref: '#/definitions/examples-property'
713752
footer:
@@ -754,6 +793,8 @@ properties:
754793
$ref: '#/definitions/root-version-property'
755794
environment_variables:
756795
$ref: '#/definitions/environment-variables-property'
796+
variables:
797+
$ref: '#/definitions/variables-property'
757798
examples:
758799
$ref: '#/definitions/examples-property'
759800
footer:

0 commit comments

Comments
 (0)