Skip to content

Commit 7faf4ca

Browse files
authored
Merge pull request #80 from DannyBen/fix/json-schema
Fix JSON schema
2 parents cfb8db1 + 3cc3ef6 commit 7faf4ca

File tree

2 files changed

+90
-68
lines changed

2 files changed

+90
-68
lines changed

.github/workflows/test.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -41,37 +41,37 @@ jobs:
4141
- name: Run tests
4242
run: bundle exec rspec
4343

44-
# json_schema:
45-
# name: Validate JSON schema
44+
json_schema:
45+
name: Validate JSON schema
4646

47-
# runs-on: ubuntu-latest
47+
runs-on: ubuntu-latest
4848

49-
# steps:
50-
# - name: Checkout code
51-
# uses: actions/checkout@v4
49+
steps:
50+
- name: Checkout code
51+
uses: actions/checkout@v4
5252

53-
# # Rush needed for easy installation of check-jsonschema
54-
# - name: Install rush
55-
# run: curl -Ls http://get.dannyb.co/rush/setup | bash
53+
# Rush needed for easy installation of check-jsonschema
54+
- name: Install rush
55+
run: curl -Ls http://get.dannyb.co/rush/setup | bash
5656

57-
# - name: Connect rush repo
58-
# run: rush clone dannyben --shallow --default
57+
- name: Connect rush repo
58+
run: rush clone dannyben --shallow --default
5959

60-
# - name: Install check-jsonschema
61-
# run: rush get check-jsonschema
60+
- name: Install check-jsonschema
61+
run: rush get check-jsonschema
6262

63-
# # libyaml needed for Ruby's YAML library
64-
# - name: Install OS dependencies
65-
# run: sudo apt-get -y install libyaml-dev
63+
# libyaml needed for Ruby's YAML library
64+
- name: Install OS dependencies
65+
run: sudo apt-get -y install libyaml-dev
6666

67-
# - name: Setup Ruby
68-
# uses: ruby/setup-ruby@v1
69-
# with:
70-
# ruby-version: '3.1'
71-
# bundler-cache: true
67+
- name: Setup Ruby
68+
uses: ruby/setup-ruby@v1
69+
with:
70+
ruby-version: '3.1'
71+
bundler-cache: true
7272

73-
# - name: Test schema
74-
# run: bundle exec run schema
73+
- name: Test schema
74+
run: bundle exec run schema
7575

7676
codespell:
7777
name: Spell check

schemas/completely.json

Lines changed: 67 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,71 @@
11
{
2-
"$schema": "http://json-schema.org/draft-07/schema",
3-
"title": "completion",
4-
"description": "A completion of the current application\nhttps://github.com/DannyBen/completely#using-the-completely-command-line",
5-
"type": "object",
6-
"patternProperties": {
7-
".": {
8-
"title": "completions",
9-
"description": "Completions of the current command or sub-command\nhttps://github.com/DannyBen/completely#using-the-completely-command-line",
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"definitions": {
4+
"word": {
5+
"type": "string",
6+
"minLength": 1,
7+
"examples": [
8+
"--help",
9+
"--version",
10+
"-h",
11+
"-v",
12+
"<alias>",
13+
"<arrayvar>",
14+
"<binding>",
15+
"<builtin>",
16+
"<command>",
17+
"<directory>",
18+
"<disabled>",
19+
"<enabled>",
20+
"<export>",
21+
"<file>",
22+
"<function>",
23+
"<group>",
24+
"<helptopic>",
25+
"<hostname>",
26+
"<job>",
27+
"<keyword>",
28+
"<running>",
29+
"<service>",
30+
"<signal>",
31+
"<stopped>",
32+
"<user>",
33+
"<variable>"
34+
]
35+
},
36+
"wordOrMapping": {
37+
"oneOf": [
38+
{ "$ref": "#/definitions/word" },
39+
{
40+
"type": "object",
41+
"additionalProperties": {
1042
"type": "array",
11-
"minItems": 1,
12-
"uniqueItems": true,
13-
"items": {
14-
"description": "A completion of the current command or sub-command\nhttps://github.com/DannyBen/completely#using-the-completely-command-line",
15-
"type": "string",
16-
"minLength": 1,
17-
"examples": [
18-
"--help",
19-
"--version",
20-
"-h",
21-
"-v",
22-
"<alias>",
23-
"<arrayvar>",
24-
"<binding>",
25-
"<builtin>",
26-
"<command>",
27-
"<directory>",
28-
"<disabled>",
29-
"<enabled>",
30-
"<export>",
31-
"<file>",
32-
"<function>",
33-
"<group>",
34-
"<helptopic>",
35-
"<hostname>",
36-
"<job>",
37-
"<keyword>",
38-
"<running>",
39-
"<service>",
40-
"<signal>",
41-
"<stopped>",
42-
"<user>",
43-
"<variable>"
44-
]
45-
}
43+
"items": { "$ref": "#/definitions/wordOrMapping" }
44+
}
4645
}
46+
]
4747
},
48-
"additionalProperties": false
49-
}
48+
"entryArray": {
49+
"type": "array",
50+
"items": { "$ref": "#/definitions/wordOrMapping" }
51+
}
52+
},
53+
"type": "object",
54+
"properties": {
55+
"completely_options": {
56+
"type": "object",
57+
"properties": {
58+
"complete_options": {
59+
"type": "string",
60+
"examples": ["-o nosort"]
61+
}
62+
},
63+
"required": ["complete_options"],
64+
"additionalProperties": false
65+
}
66+
},
67+
"patternProperties": {
68+
"^(?!completely_options$).*": { "$ref": "#/definitions/entryArray" }
69+
},
70+
"additionalProperties": false
71+
}

0 commit comments

Comments
 (0)