Skip to content

Commit

Permalink
Update JSON examples
Browse files Browse the repository at this point in the history
and adjust workflow to use same formatter
  • Loading branch information
ralfhandl committed Aug 21, 2024
1 parent a548294 commit 8d257cb
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/convert-examples-to-json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: convert YAML examples to JSON
run: find examples/v3* -type f -name "*.yaml" | xargs node scripts/yaml2json/yaml2json.js

- name: pretty-print JSON examples
run: npx prettier --write examples/**/*.json

- name: git diff
run: |
git add examples/**/*.json
Expand Down
27 changes: 26 additions & 1 deletion examples/v3.0/api-with-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,32 @@
"application/json": {
"examples": {
"foo": {
"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"
"value": {
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
},
{
"status": "EXPERIMENTAL",
"updated": "2013-07-23T11:33:21Z",
"id": "v3.0",
"links": [
{
"href": "http://127.0.0.1:8774/v3/",
"rel": "self"
}
]
}
]
}
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"homepage": "https://learn.openapis.org",
"dependencies": {
"@hyperjump/json-schema": "^1.9.2",
"prettier": "^3.3.3",
"vitest": "^1.6.0",
"yaml": "^2.4.3"
}
Expand Down

0 comments on commit 8d257cb

Please sign in to comment.