Skip to content

Commit a525fb5

Browse files
author
Michael Buchar
committed
ci(jsonlint): add jsonlint formatting checks (#655)
1 parent 14e3919 commit a525fb5

5 files changed

Lines changed: 98 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,20 @@ jobs:
171171
npm install prettier --global
172172
./run-tests.sh --check-prettier
173173
174+
lint-jsonlint:
175+
runs-on: ubuntu-24.04
176+
steps:
177+
- name: Checkout
178+
uses: actions/checkout@v4
179+
180+
- name: Setup Node
181+
uses: actions/setup-node@v4
182+
183+
- name: Lint JSON files
184+
run: |
185+
npm install jsonlint --global
186+
./run-tests.sh --check-jsonlint
187+
174188
docs-sphinx:
175189
runs-on: ubuntu-24.04
176190
steps:

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
CHANGELOG.md
2+
docs/openapi.json

docs/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!-- markdownlint-disable MD041 -->
2+
<!-- markdownlint-disable MD033 -->
23

34
```{include} ../README.md
45
:end-before: "## About"
@@ -12,8 +13,8 @@
1213
## REST API
1314

1415
The REANA-Workflow-Controller component offers a REST API for managing
15-
workflows.
16-
[Detailed REST API documentation can be found here]("_static/api.html").
16+
workflows. workflows. Detailed REST API documentation can be found
17+
<a href="_static/api.html">here</a>.
1718

1819
```{eval-rst}
1920
.. automodule:: reana_workflow_controller.rest.workflows

docs/openapi.json

Lines changed: 74 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@
112112
"type": "string"
113113
}
114114
],
115-
"produces": ["application/json"],
115+
"produces": [
116+
"application/json"
117+
],
116118
"responses": {
117119
"200": {
118120
"description": "Requests succeeded. The response contains the current workflows for a given user.",
@@ -322,7 +324,9 @@
322324
}
323325
}
324326
],
325-
"produces": ["application/json"],
327+
"produces": [
328+
"application/json"
329+
],
326330
"responses": {
327331
"201": {
328332
"description": "Request succeeded. The workflow has been created along with its workspace",
@@ -365,7 +369,9 @@
365369
},
366370
"/api/workflows/move_files/{workflow_id_or_name}": {
367371
"put": {
368-
"consumes": ["application/json"],
372+
"consumes": [
373+
"application/json"
374+
],
369375
"description": "This resource moves files within the workspace. Resource is expecting a workflow UUID.",
370376
"operationId": "move_files",
371377
"parameters": [
@@ -398,7 +404,9 @@
398404
"type": "string"
399405
}
400406
],
401-
"produces": ["application/json"],
407+
"produces": [
408+
"application/json"
409+
],
402410
"responses": {
403411
"200": {
404412
"description": "Request succeeded. Message about successfully moved files is returned.",
@@ -498,13 +506,17 @@
498506
"type": "string"
499507
}
500508
],
501-
"produces": ["application/json"],
509+
"produces": [
510+
"application/json"
511+
],
502512
"responses": {
503513
"200": {
504514
"description": "Request succeeded. Info about a workflow, including the status is returned.",
505515
"examples": {
506516
"application/json": {
507-
"reana_specification": ["- nevents: 100000\n+ nevents: 200000"],
517+
"reana_specification": [
518+
"- nevents: 100000\n+ nevents: 200000"
519+
],
508520
"workspace_listing": {
509521
"Only in workspace a: code": null
510522
}
@@ -555,7 +567,9 @@
555567
},
556568
"/api/workflows/{workflow_id_or_name}/close": {
557569
"post": {
558-
"consumes": ["application/json"],
570+
"consumes": [
571+
"application/json"
572+
],
559573
"description": "This resource is expecting a workflow to close an interactive session within its workspace.",
560574
"operationId": "close_interactive_session",
561575
"parameters": [
@@ -574,7 +588,9 @@
574588
"type": "string"
575589
}
576590
],
577-
"produces": ["application/json"],
591+
"produces": [
592+
"application/json"
593+
],
578594
"responses": {
579595
"200": {
580596
"description": "Request succeeded. The interactive session has been closed.",
@@ -663,7 +679,9 @@
663679
"type": "integer"
664680
}
665681
],
666-
"produces": ["application/json"],
682+
"produces": [
683+
"application/json"
684+
],
667685
"responses": {
668686
"200": {
669687
"description": "Request succeeded. Info about workflow, including the status is returned.",
@@ -722,7 +740,9 @@
722740
},
723741
"/api/workflows/{workflow_id_or_name}/open/{interactive_session_type}": {
724742
"post": {
725-
"consumes": ["application/json"],
743+
"consumes": [
744+
"application/json"
745+
],
726746
"description": "This resource is expecting a workflow to start an interactive session within its workspace.",
727747
"operationId": "open_interactive_session",
728748
"parameters": [
@@ -763,7 +783,9 @@
763783
}
764784
}
765785
],
766-
"produces": ["application/json"],
786+
"produces": [
787+
"application/json"
788+
],
767789
"responses": {
768790
"200": {
769791
"description": "Request succeeded. The interactive session has been opened.",
@@ -824,7 +846,9 @@
824846
"type": "string"
825847
}
826848
],
827-
"produces": ["application/json"],
849+
"produces": [
850+
"application/json"
851+
],
828852
"responses": {
829853
"200": {
830854
"description": "Request succeeded. Workflow input parameters, including the status are returned.",
@@ -910,7 +934,9 @@
910934
"type": "string"
911935
}
912936
],
913-
"produces": ["application/json"],
937+
"produces": [
938+
"application/json"
939+
],
914940
"responses": {
915941
"200": {
916942
"description": "Request succeeded. The response contains the list of all the retention rules.",
@@ -1040,12 +1066,16 @@
10401066
"type": "string"
10411067
}
10421068
},
1043-
"required": ["user_email_to_share_with"],
1069+
"required": [
1070+
"user_email_to_share_with"
1071+
],
10441072
"type": "object"
10451073
}
10461074
}
10471075
],
1048-
"produces": ["application/json"],
1076+
"produces": [
1077+
"application/json"
1078+
],
10491079
"responses": {
10501080
"200": {
10511081
"description": "Request succeeded. The workflow has been shared with the user.",
@@ -1122,7 +1152,9 @@
11221152
"type": "string"
11231153
}
11241154
],
1125-
"produces": ["application/json"],
1155+
"produces": [
1156+
"application/json"
1157+
],
11261158
"responses": {
11271159
"200": {
11281160
"description": "Request succeeded. The response contains the share status of the workflow.",
@@ -1221,7 +1253,9 @@
12211253
"type": "string"
12221254
}
12231255
],
1224-
"produces": ["application/json"],
1256+
"produces": [
1257+
"application/json"
1258+
],
12251259
"responses": {
12261260
"200": {
12271261
"description": "Request succeeded. Info about workflow, including the status is returned.",
@@ -1311,7 +1345,11 @@
13111345
},
13121346
{
13131347
"description": "Required. New status.",
1314-
"enum": ["start", "stop", "deleted"],
1348+
"enum": [
1349+
"start",
1350+
"stop",
1351+
"deleted"
1352+
],
13151353
"in": "query",
13161354
"name": "status",
13171355
"required": true,
@@ -1349,7 +1387,9 @@
13491387
}
13501388
}
13511389
],
1352-
"produces": ["application/json"],
1390+
"produces": [
1391+
"application/json"
1392+
],
13531393
"responses": {
13541394
"200": {
13551395
"description": "Request succeeded. Info about workflow, including the status is returned.",
@@ -1465,7 +1505,9 @@
14651505
"type": "string"
14661506
}
14671507
],
1468-
"produces": ["application/json"],
1508+
"produces": [
1509+
"application/json"
1510+
],
14691511
"responses": {
14701512
"200": {
14711513
"description": "Request succeeded. The workflow has been unshared with the user.",
@@ -1623,7 +1665,9 @@
16231665
"type": "string"
16241666
}
16251667
],
1626-
"produces": ["multipart/form-data"],
1668+
"produces": [
1669+
"multipart/form-data"
1670+
],
16271671
"responses": {
16281672
"200": {
16291673
"description": "Requests succeeded. The list of code|input|output files has been retrieved.",
@@ -1684,7 +1728,9 @@
16841728
"summary": "Returns the workspace file list."
16851729
},
16861730
"post": {
1687-
"consumes": ["application/octet-stream"],
1731+
"consumes": [
1732+
"application/octet-stream"
1733+
],
16881734
"description": "This resource is expecting a workflow UUID and a file to place in the workspace.",
16891735
"operationId": "upload_file",
16901736
"parameters": [
@@ -1719,7 +1765,9 @@
17191765
"type": "string"
17201766
}
17211767
],
1722-
"produces": ["application/json"],
1768+
"produces": [
1769+
"application/json"
1770+
],
17231771
"responses": {
17241772
"200": {
17251773
"description": "Request succeeded. The file has been added to the workspace.",
@@ -1790,7 +1838,9 @@
17901838
"type": "string"
17911839
}
17921840
],
1793-
"produces": ["application/json"],
1841+
"produces": [
1842+
"application/json"
1843+
],
17941844
"responses": {
17951845
"200": {
17961846
"description": "Request succeeded. Details about deleted files and failed deletions are returned.",

run-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ check_prettier() {
127127
prettier -c .
128128
}
129129

130+
check_jsonlint() {
131+
find . -name "*.json" -exec jsonlint -q {} \+
132+
}
133+
130134
check_pytest() {
131135
clean_old_db_container
132136
start_db_container
@@ -159,6 +163,7 @@ check_all() {
159163
check_yamllint
160164
check_markdownlint
161165
check_prettier
166+
check_jsonlint
162167
}
163168

164169
if [ $# -eq 0 ]; then
@@ -183,5 +188,6 @@ case $arg in
183188
--check-yamllint) check_yamllint ;;
184189
--check-markdownlint) check_markdownlint ;;
185190
--check-prettier) check_prettier ;;
191+
--check-jsonlint) check_jsonlint ;;
186192
*) echo "[ERROR] Invalid argument '$arg'. Exiting." && exit 1 ;;
187193
esac

0 commit comments

Comments
 (0)