Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 72 additions & 10 deletions schemas/bashly.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"title": "allowed",
"description": "Valid values of the current positional argument\nhttps://bashly.dannyb.co/configuration/argument/#allowed",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "A valid value of the current positional argument",
Expand Down Expand Up @@ -193,7 +193,7 @@
"title": "allowed",
"description": "Valid values of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#allowed",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "A valid value of the current positional argument",
Expand All @@ -208,7 +208,7 @@
"title": "conflicts",
"description": "Mutually exclusive flags of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#conflicts",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "The long form of the required flag",
Expand All @@ -223,7 +223,7 @@
"title": "needs",
"description": "Additional flags required by the current flag\nhttps://bashly.dannyb.co/configuration/flag/#needs",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "The long form of the required flag",
Expand All @@ -238,7 +238,7 @@
"title": "completions",
"description": "Completions of the current flag\nhttps://bashly.dannyb.co/configuration/flag/#completions",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "A completion of the current flag",
Expand Down Expand Up @@ -349,7 +349,7 @@
"title": "allowed",
"description": "Valid values of the current environment variable\nhttps://bashly.dannyb.co/configuration/environment-variable/#allowed",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "A valid value of the current environment variable",
Expand Down Expand Up @@ -380,6 +380,50 @@
},
"additionalProperties": false
},
"variable": {
"title": "variable",
"description": "A global bash variable\nhttps://bashly.dannyb.co/configuration/command/#variables",
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"title": "name",
"description": "A name for the current variable",
"type": "string",
"minLength": 1,
"examples": [
"output_dir"
]
},
"value": {
"title": "value",
"description": "A value for the current variable",
"examples": [
"output_dir",
[
"development",
"production"
],
{
"verbosity": 3,
"debug": true
}
]
}
},
"patternProperties": {
"^x_.": {
"title": "custom property",
"description": "A custom property of any type",
"examples": [
"Anything"
]
}
},
"additionalProperties": false
},
"name-property": {
"title": "name",
"description": "A name of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#name",
Expand Down Expand Up @@ -430,8 +474,8 @@
"title": "args",
"description": "Arguments of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#args",
"type": "array",
"uniqueItems": true,
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "#/definitions/argument"
}
Expand All @@ -440,8 +484,8 @@
"title": "flags",
"description": "Flags of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#flags",
"type": "array",
"uniqueItems": true,
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "#/definitions/flag"
}
Expand All @@ -450,6 +494,7 @@
"title": "commands",
"description": "Subcommands of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#commands",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "#/definitions/command-property"
Expand Down Expand Up @@ -485,11 +530,22 @@
"title": "environment variables",
"description": "Environment variables of the current application\nhttps://bashly.dannyb.co/configuration/environment-variable/#environment-variable",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "#/definitions/environment-variable"
}
},
"variables-property": {
"title": "variables",
"description": "Bash variables for the current application\nhttps://bashly.dannyb.co/configuration/command/#variables",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"$ref": "#/definitions/variable"
}
},
"examples-property": {
"title": "examples",
"oneOf": [
Expand Down Expand Up @@ -583,7 +639,7 @@
"title": "completions",
"description": "Completions of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/command/#completions",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "A completion of the current script or sub-command",
Expand Down Expand Up @@ -647,7 +703,7 @@
{
"description": "Dependencies of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency",
"type": "array",
"minLength": 1,
"minItems": 1,
"uniqueItems": true,
"items": {
"description": "A dependency of the current script or sub-command\nhttps://bashly.dannyb.co/configuration/dependency/#dependency",
Expand Down Expand Up @@ -806,6 +862,9 @@
"environment_variables": {
"$ref": "#/definitions/environment-variables-property"
},
"variables": {
"$ref": "#/definitions/variables-property"
},
"examples": {
"$ref": "#/definitions/examples-property"
},
Expand Down Expand Up @@ -880,6 +939,9 @@
"environment_variables": {
"$ref": "#/definitions/environment-variables-property"
},
"variables": {
"$ref": "#/definitions/variables-property"
},
"examples": {
"$ref": "#/definitions/examples-property"
},
Expand Down
61 changes: 51 additions & 10 deletions support/schema/bashly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ definitions:
Valid values of the current positional argument
https://bashly.dannyb.co/configuration/argument/#allowed
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: A valid value of the current positional argument
Expand Down Expand Up @@ -172,7 +172,7 @@ definitions:
Valid values of the current flag
https://bashly.dannyb.co/configuration/flag/#allowed
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: A valid value of the current positional argument
Expand All @@ -186,7 +186,7 @@ definitions:
Mutually exclusive flags of the current flag
https://bashly.dannyb.co/configuration/flag/#conflicts
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: The long form of the required flag
Expand All @@ -200,7 +200,7 @@ definitions:
Additional flags required by the current flag
https://bashly.dannyb.co/configuration/flag/#needs
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: The long form of the required flag
Expand All @@ -214,7 +214,7 @@ definitions:
Completions of the current flag
https://bashly.dannyb.co/configuration/flag/#completions
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: A completion of the current flag
Expand Down Expand Up @@ -317,7 +317,7 @@ definitions:
Valid values of the current environment variable
https://bashly.dannyb.co/configuration/environment-variable/#allowed
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: A valid value of the current environment variable
Expand All @@ -335,6 +335,31 @@ definitions:
- ~/config.ini
patternProperties: *custom-properties
additionalProperties: false
variable:
title: variable
description: |-
A global bash variable
https://bashly.dannyb.co/configuration/command/#variables
type: object
required:
- name
properties:
name:
title: name
description: A name for the current variable
type: string
minLength: 1
examples:
- output_dir
value:
title: value
description: A value for the current variable
examples:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the variable value is null ? Is it an error? What it corresponds to in Bash (in the context of Bashly) if it's not?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null is allowed (it will be null if not provided), and the bash variable definition will simply be varname="".

- output_dir
- [development, production]
- { verbosity: 3, debug: true }
patternProperties: *custom-properties
additionalProperties: false
name-property:
title: name
description: |-
Expand Down Expand Up @@ -382,8 +407,8 @@ definitions:
Arguments of the current script or sub-command
https://bashly.dannyb.co/configuration/command/#args
type: array
uniqueItems: true
minItems: 1
uniqueItems: true
items:
$ref: '#/definitions/argument'
flags-property:
Expand All @@ -392,8 +417,8 @@ definitions:
Flags of the current script or sub-command
https://bashly.dannyb.co/configuration/command/#flags
type: array
uniqueItems: true
minItems: 1
uniqueItems: true
items:
$ref: '#/definitions/flag'
commands-property:
Expand All @@ -402,6 +427,7 @@ definitions:
Subcommands of the current script or sub-command
https://bashly.dannyb.co/configuration/command/#commands
type: array
minItems: 1
uniqueItems: true
items:
$ref: '#/definitions/command-property'
Expand Down Expand Up @@ -432,9 +458,20 @@ definitions:
Environment variables of the current application
https://bashly.dannyb.co/configuration/environment-variable/#environment-variable
type: array
minItems: 1
uniqueItems: true
items:
$ref: '#/definitions/environment-variable'
variables-property:
title: variables
description: |-
Bash variables for the current application
https://bashly.dannyb.co/configuration/command/#variables
type: array
minItems: 1
uniqueItems: true
Copy link
Collaborator

@EmilyGraceSeville7cf EmilyGraceSeville7cf Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add minItems: 1. It is the matter of the answer to the following question: Should we remind the user that something is expected in an array of let it go (if an empty array is not an error in config)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added minItems: 1 and updated some other arrays that had minLength instead of minItems.

items:
$ref: '#/definitions/variable'
examples-property:
title: examples
oneOf:
Expand Down Expand Up @@ -520,7 +557,7 @@ definitions:
Completions of the current script or sub-command
https://bashly.dannyb.co/configuration/command/#completions
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: A completion of the current script or sub-command
Expand Down Expand Up @@ -583,7 +620,7 @@ definitions:
Dependencies of the current script or sub-command
https://bashly.dannyb.co/configuration/dependency/#dependency
type: array
minLength: 1
minItems: 1
uniqueItems: true
items:
description: |-
Expand Down Expand Up @@ -708,6 +745,8 @@ definitions:
$ref: '#/definitions/sub-command-default-property'
environment_variables:
$ref: '#/definitions/environment-variables-property'
variables:
$ref: '#/definitions/variables-property'
examples:
$ref: '#/definitions/examples-property'
footer:
Expand Down Expand Up @@ -754,6 +793,8 @@ properties:
$ref: '#/definitions/root-version-property'
environment_variables:
$ref: '#/definitions/environment-variables-property'
variables:
$ref: '#/definitions/variables-property'
examples:
$ref: '#/definitions/examples-property'
footer:
Expand Down