Skip to content

Commit 8d257cb

Browse files
committed
Update JSON examples
and adjust workflow to use same formatter
1 parent a548294 commit 8d257cb

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

.github/workflows/convert-examples-to-json.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ jobs:
3636
- name: convert YAML examples to JSON
3737
run: find examples/v3* -type f -name "*.yaml" | xargs node scripts/yaml2json/yaml2json.js
3838

39+
- name: pretty-print JSON examples
40+
run: npx prettier --write examples/**/*.json
41+
3942
- name: git diff
4043
run: |
4144
git add examples/**/*.json

examples/v3.0/api-with-examples.json

+26-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,32 @@
5353
"application/json": {
5454
"examples": {
5555
"foo": {
56-
"value": "{\n \"versions\": [\n {\n \"status\": \"CURRENT\",\n \"updated\": \"2011-01-21T11:33:21Z\",\n \"id\": \"v2.0\",\n \"links\": [\n {\n \"href\": \"http://127.0.0.1:8774/v2/\",\n \"rel\": \"self\"\n }\n ]\n },\n {\n \"status\": \"EXPERIMENTAL\",\n \"updated\": \"2013-07-23T11:33:21Z\",\n \"id\": \"v3.0\",\n \"links\": [\n {\n \"href\": \"http://127.0.0.1:8774/v3/\",\n \"rel\": \"self\"\n }\n ]\n }\n ]\n}\n"
56+
"value": {
57+
"versions": [
58+
{
59+
"status": "CURRENT",
60+
"updated": "2011-01-21T11:33:21Z",
61+
"id": "v2.0",
62+
"links": [
63+
{
64+
"href": "http://127.0.0.1:8774/v2/",
65+
"rel": "self"
66+
}
67+
]
68+
},
69+
{
70+
"status": "EXPERIMENTAL",
71+
"updated": "2013-07-23T11:33:21Z",
72+
"id": "v3.0",
73+
"links": [
74+
{
75+
"href": "http://127.0.0.1:8774/v3/",
76+
"rel": "self"
77+
}
78+
]
79+
}
80+
]
81+
}
5782
}
5883
}
5984
}

package-lock.json

+16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"homepage": "https://learn.openapis.org",
3131
"dependencies": {
3232
"@hyperjump/json-schema": "^1.9.2",
33+
"prettier": "^3.3.3",
3334
"vitest": "^1.6.0",
3435
"yaml": "^2.4.3"
3536
}

0 commit comments

Comments
 (0)