Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schemas for: LinUtil #4080

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
12 changes: 12 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -6884,6 +6884,18 @@
"description": "Preset list for a WinUtil",
"fileMatch": ["**/*winutil*/config/preset.json"],
"url": "https://raw.githubusercontent.com/winutil-preset.json"
},
{
"name": "Tab list for a LinUtil",
"description": "Tab list for a LinUtil",
"fileMatch": ["**/*linutil*/**/tabs.toml"],
"url": "https://raw.githubusercontent.com/linutil-tabs.json"
},
{
"name": "Tab data for a LinUtil",
"description": "Tab data for a LinUtil",
"fileMatch": ["**/*linutil*/**/tab_data.toml"],
"url": "https://raw.githubusercontent.com/linutil-tab-data.json"
}
]
}
26 changes: 26 additions & 0 deletions src/negative_test/linutil-tab-data/invalid-properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"data": [
{
"name": "",
"script": ""
},
{
"entries": [
{
"name": "",
"script": ""
}
],
"name": "",
"preconditions": [
{
"data": {
"environment": ""
},
"values": [""]
}
]
}
],
"name": ""
}
3 changes: 3 additions & 0 deletions src/negative_test/linutil-tabs/invalid-items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directories": [""]
}
123 changes: 123 additions & 0 deletions src/schemas/json/linutil-tab-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://raw.githubusercontent.com/linutil-tab-data.json",
"definitions": {
"string-property": {
"type": "string",
"minLength": 1,
"pattern": "[^ ]"
}
},
"title": "tab data",
"description": "Tab data",
"type": "object",
"required": ["name", "data"],
"properties": {
"name": {
"$ref": "#/definitions/string-property",
"title": "name",
"description": "The name of a tab"
},
"data": {
"title": "data",
"description": "The data of a tab",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"title": "data entry",
"description": "The data entry of a tab",
"type": "object",
"properties": {
"name": {
"$ref": "#/definitions/string-property",
"title": "name",
"description": "The name of a tab entry"
},
"script": {
"$ref": "#/definitions/string-property",
"title": "script",
"description": "The script run of a tab entry"
},
"preconditions": {
"title": "preconditions",
"description": "Preconditions of a tab entry",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"title": "precondition entry",
"description": "The precondition entry of a tab entry",
"type": "object",
"properties": {
"matches": {
"title": "matches",
"description": "Whether to require the condition to match or not for a precondition entry",
"type": "boolean"
},
"data": {
"title": "data",
"description": "The data of a tab precondition entry",
"type": "object",
"properties": {
"environment": {
"$ref": "#/definitions/string-property",
"title": "environment",
"description": "The environment variable of a data"
}
},
"additionalProperties": false
},
"values": {
"title": "values",
"description": "The values of a tab precondition entry",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"title": "entry",
"description": "The entry of values",
"type": "string"
}
}
},
"additionalProperties": false
}
},
"entries": {
"title": "entries",
"description": "The entries of a tab entry",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"title": "entry",
"description": "The entry",
"type": "object",
"properties": {
"name": {
"$ref": "#/definitions/string-property",
"title": "name",
"description": "The name of a tab entry"
},
"script": {
"$ref": "#/definitions/string-property",
"title": "script",
"description": "The script run of a tab entry"
},
"matches": {
"title": "matches",
"description": "Whether to require the condition to match or not for an entry",
"type": "boolean"
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
}
},
"additionalProperties": false
}
25 changes: 25 additions & 0 deletions src/schemas/json/linutil-tabs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "https://raw.githubusercontent.com/linutil-tabs.json",
"title": "tab data",
"description": "Tab data",
"type": "object",
"required": ["directories"],
"properties": {
"directories": {
"title": "directories",
"description": "The directories of tabs",
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"title": "directory entry",
"description": "The directory entry of a tab",
"type": "string",
"minLength": 1,
"pattern": "[^ ]"
}
}
},
"additionalProperties": false
}
71 changes: 71 additions & 0 deletions src/test/linutil-tab-data/one-tab.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"data": [
{
"name": "WiFi Manager",
"script": "wifi-control.sh"
},
{
"entries": [
{
"name": "Duplicate Displays",
"script": "monitor-control/duplicate_displays.sh"
},
{
"name": "Extend Displays",
"script": "monitor-control/extend_displays.sh"
},
{
"name": "Auto Detect Displays",
"script": "monitor-control/auto_detect_displays.sh"
},
{
"name": "Enable Monitor",
"script": "monitor-control/enable_monitor.sh"
},
{
"name": "Disable Monitor",
"script": "monitor-control/disable_monitor.sh"
},
{
"name": "Set Primary Monitor",
"script": "monitor-control/set_primary_monitor.sh"
},
{
"name": "Change Orientation",
"script": "monitor-control/change_orientation.sh"
},
{
"name": "Manage Arrangement",
"script": "monitor-control/manage_arrangement.sh"
},
{
"name": "Scale Monitors",
"script": "monitor-control/scale_monitor.sh"
},
{
"matches": true,
"name": "Reset Scaling",
"script": "monitor-control/reset_scaling.sh"
}
],
"name": "Monitor Control",
"preconditions": [
{
"data": {
"environment": "XDG_SESSION_TYPE"
},
"matches": true,
"values": ["x11", "X11", "xorg", "Xorg", "tty"]
},
{
"data": {
"environment": "DISPLAY"
},
"matches": true,
"values": [":0", ":1", ":2", ":3", ":4", ":5", ":6", ":7", ":8", ":9"]
}
]
}
],
"name": "Utilities"
}
9 changes: 9 additions & 0 deletions src/test/linutil-tabs/top-level-directories.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"directories": [
"applications-setup",
"gaming",
"security",
"system-setup",
"utils"
]
}