Skip to content

Commit 22df63e

Browse files
CCM-13152 - Upgrade redocly and fix example files (#252)
* CCM-13152 - Upgrade redocly and fix example files * moved copy examples to script
1 parent 349b027 commit 22df63e

25 files changed

+338
-450
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ serve-swagger:
9494
npm run serve-swagger-docs
9595

9696
copy-examples:
97-
cp -r ./sandbox/data/examples/. ./specification/api/components/examples
97+
@scripts/build/copy-examples.sh
9898

9999
config:: _install-dependencies version # Configure development environment (main) @Configuration
100100
npm install

package-lock.json

Lines changed: 296 additions & 387 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"@openapitools/openapi-generator-cli": "^2.21.4",
13-
"@redocly/cli": "^1.34.5",
13+
"@redocly/cli": "^2.11.1",
1414
"@tsconfig/node22": "^22.0.2",
1515
"@types/jest": "^30.0.0",
1616
"@types/js-yaml": "^4.0.9",

sandbox/data/examples/createMI/requests/createMI_INVALID.json renamed to sandbox/data/examples/createMI/requests/createMI_request_INVALID.json

File renamed without changes.

sandbox/data/examples/createMI/requests/createMI_NOTFOUND.json renamed to sandbox/data/examples/createMI/requests/createMI_request_NOTFOUND.json

File renamed without changes.

sandbox/data/examples/createMI/requests/createMI_SUCCESS.json renamed to sandbox/data/examples/createMI/requests/createMI_request_SUCCESS.json

File renamed without changes.

sandbox/data/examples/createMI/responses/createMI_SUCCESS.json renamed to sandbox/data/examples/createMI/responses/createMI_response_SUCCESS.json

File renamed without changes.

sandbox/utils/ResponseProvider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ async function postLettersResponse(request) {
101101

102102
async function postMIResponse(request) {
103103
const postMIFileMap = {
104-
'data/examples/createMI/requests/createMI_SUCCESS.json': {responsePath: 'data/examples/createMI/responses/createMI_SUCCESS.json', responseCode: 200},
105-
'data/examples/createMI/requests/createMI_INVALID.json': {responsePath:'data/examples/errors/responses/badRequest.json',responseCode: 400},
106-
'data/examples/createMI/requests/createMI_NOTFOUND.json': {responsePath:'data/examples/errors/responses/resourceNotFound.json',responseCode: 404},
104+
'data/examples/createMI/requests/createMI_request_SUCCESS.json': {responsePath: 'data/examples/createMI/responses/createMI_response_SUCCESS.json', responseCode: 200},
105+
'data/examples/createMI/requests/createMI_request_INVALID.json': {responsePath:'data/examples/errors/responses/badRequest.json',responseCode: 400},
106+
'data/examples/createMI/requests/createMI_request_NOTFOUND.json': {responsePath:'data/examples/errors/responses/resourceNotFound.json',responseCode: 404},
107107
};
108108
return await mapExampleResponse(request, postMIFileMap);
109109
}

scripts/build/copy-examples.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
find ./sandbox/data/examples -type f -name '*.json' \
2+
| while read f; do \
3+
out=./specification/api/components/examples/${f#./sandbox/data/examples/}; \
4+
mkdir -p $(dirname $out); \
5+
jq '{ value: . }' "$f" > "$out"; \
6+
done

specification/api/components/requests/patchLetterRequest.yml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,53 +10,40 @@ content:
1010
examples:
1111
patch-letter-request-default:
1212
summary: Request for default (PENDING) update
13-
value:
14-
$ref: ../examples/patchLetter/requests/patchLetter_DEFAULT.json
13+
$ref: ../examples/patchLetter/requests/patchLetter_DEFAULT.json
1514
patch-letter-request-pending:
1615
summary: Request for PENDING update
17-
value:
18-
$ref: ../examples/patchLetter/requests/patchLetter_PENDING.json
16+
$ref: ../examples/patchLetter/requests/patchLetter_PENDING.json
1917
patch-letter-request-accepted:
2018
summary: Request for ACCEPTED update
21-
value:
22-
$ref: ../examples/patchLetter/requests/patchLetter_ACCEPTED.json
19+
$ref: ../examples/patchLetter/requests/patchLetter_ACCEPTED.json
2320
patch-letter-request-rejected:
2421
summary: Request for REJECTED update
25-
value:
26-
$ref: ../examples/patchLetter/requests/patchLetter_REJECTED.json
22+
$ref: ../examples/patchLetter/requests/patchLetter_REJECTED.json
2723
patch-letter-request-printed:
2824
summary: Request for PRINTED update
29-
value:
30-
$ref: ../examples/patchLetter/requests/patchLetter_PRINTED.json
25+
$ref: ../examples/patchLetter/requests/patchLetter_PRINTED.json
3126
patch-letter-request-enclosed:
3227
summary: Request for ENCLOSED update
33-
value:
34-
$ref: ../examples/patchLetter/requests/patchLetter_ENCLOSED.json
28+
$ref: ../examples/patchLetter/requests/patchLetter_ENCLOSED.json
3529
patch-letter-request-cancelled:
3630
summary: Request for CANCELLED update
37-
value:
38-
$ref: ../examples/patchLetter/requests/patchLetter_CANCELLED.json
31+
$ref: ../examples/patchLetter/requests/patchLetter_CANCELLED.json
3932
patch-letter-request-dispatched:
4033
summary: Request for DISPATCHED update
41-
value:
42-
$ref: ../examples/patchLetter/requests/patchLetter_DISPATCHED.json
34+
$ref: ../examples/patchLetter/requests/patchLetter_DISPATCHED.json
4335
patch-letter-request-delivered:
4436
summary: Request for DELIVERED update
45-
value:
46-
$ref: ../examples/patchLetter/requests/patchLetter_DELIVERED.json
37+
$ref: ../examples/patchLetter/requests/patchLetter_DELIVERED.json
4738
patch-letter-request-failed:
4839
summary: Request for FAILED update
49-
value:
50-
$ref: ../examples/patchLetter/requests/patchLetter_FAILED.json
40+
$ref: ../examples/patchLetter/requests/patchLetter_FAILED.json
5141
patch-letter-request-returned:
5242
summary: Request for RETURNED update
53-
value:
54-
$ref: ../examples/patchLetter/requests/patchLetter_RETURNED.json
43+
$ref: ../examples/patchLetter/requests/patchLetter_RETURNED.json
5544
patch-letter-request-invalid:
5645
summary: Request for an invalid update
57-
value:
58-
$ref: ../examples/patchLetter/requests/patchLetter_INVALID.json
46+
$ref: ../examples/patchLetter/requests/patchLetter_INVALID.json
5947
patch-letter-request-not-found:
6048
summary: Request for a non existant letter
61-
value:
62-
$ref: ../examples/patchLetter/requests/patchLetter_NOTFOUND.json
49+
$ref: ../examples/patchLetter/requests/patchLetter_NOTFOUND.json

0 commit comments

Comments
 (0)