Skip to content

Commit 79b6460

Browse files
tatomyrJLekawa
andauthored
fix: replace backslashes with forward slashes in refs on Windows when splitting (#1903)
* fix: replace backslashes with forward slashes in refs on Windows when splitting * update tests * Update .changeset/eighty-dolls-sniff.md * Update __tests__/smoke/run-smoke.sh * remove redundant non-null assertion * improve the build-docs smoke test check --------- Co-authored-by: Jacek Łękawa <164185257+JLekawa@users.noreply.github.com>
1 parent e1c065b commit 79b6460

File tree

91 files changed

+2337
-27
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+2337
-27
lines changed

.changeset/eighty-dolls-sniff.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@redocly/cli": patch
3+
---
4+
5+
Fixed a problem where the `split` command produced backslashes instead of forward slashes in `$ref`s on Windows.

.github/workflows/smoke-plugins.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install dependencies
2121
run: npm ci
2222
- name: Prepare Smoke
23-
run: bash ./scripts/prepare-smoke-plugins.sh
23+
run: bash ./__tests__/smoke-plugins/prepare-smoke-plugins.sh
2424
- uses: actions/cache@v3
2525
with:
2626
path: __tests__/smoke-plugins/

.github/workflows/smoke.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
- name: Install dependencies
2121
run: npm ci
2222
- name: Prepare Smoke
23-
run: bash ./scripts/prepare-smoke.sh
23+
run: bash ./__tests__/smoke/prepare-smoke.sh
2424
- uses: actions/cache@v3
2525
with:
2626
path: __tests__/smoke/
@@ -291,15 +291,23 @@ jobs:
291291
run: docker build -t redocly/cli:latest .
292292
- name: Run docker image
293293
run: |
294+
# Prepare
295+
cp resources/pets.yaml resources/museum.yaml __tests__/smoke/
294296
cd __tests__/smoke/
297+
298+
# Run commands
295299
docker run --rm redocly/cli:latest --version
296300
docker run --rm -v $PWD:/spec redocly/cli:latest lint openapi.yaml
297301
docker run --rm -v $PWD:/spec redocly/cli:latest bundle openapi.yaml --ext json
298302
docker run --rm -v $PWD:/spec redocly/cli:latest build-docs openapi.yaml
299-
# Check for broken styles (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
300-
if [[ "$(wc -l redoc-static.html)" == "324 redoc-static.html" ]]; then
301-
echo "Docs built correctly."
302-
else
303-
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 324 lines in redoc-static.html)."
304-
exit 1
305-
fi
303+
docker run --rm -v $PWD:/spec redocly/cli:latest split pets.yaml --outDir output/split/petstore && docker run --rm -v $PWD:/spec redocly/cli:latest split museum.yaml --outDir output/split/museum
304+
305+
# Check for broken styles when building docs (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
306+
echo "Checking docs for issues..."
307+
diff pre-built/redoc.html redoc-static.html
308+
echo "✅ Docs built correctly."
309+
310+
# Check for broken $refs (or other issues) in the split files, especially on Windows (it will fail on a difference)
311+
echo "Checking split files for issues..."
312+
diff -r pre-split output/split
313+
echo "✅ Files split correctly."
File renamed without changes.

__tests__/smoke/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"redocly-version": "redocly --version",
99
"redocly-lint": "redocly lint openapi.yaml",
1010
"redocly-bundle": "redocly bundle openapi.yaml --ext json",
11-
"redocly-build-docs": "redocly build-docs openapi.yaml"
11+
"redocly-build-docs": "redocly build-docs openapi.yaml",
12+
"redocly-split": "redocly split pets.yaml --outDir output/split/petstore && redocly split museum.yaml --outDir output/split/museum"
1213
},
1314
"author": "redocly",
1415
"license": "ISC"

__tests__/smoke/pre-built/redoc.html

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
summary: Special event ticket
2+
value:
3+
ticketType: general
4+
eventId: dad4bce8-f5cb-4078-a211-995864315e39
5+
ticketDate: '2023-09-05'
6+
email: todd@example.com
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
summary: Special event ticket
2+
value:
3+
message: Museum special event ticket purchased
4+
ticketId: b811f723-17b2-44f7-8952-24b03e43d8a9
5+
eventName: Mermaid Treasure Identification and Analysis
6+
ticketType: event
7+
ticketDate: '2023-09-05'
8+
confirmationCode: ticket-event-9c55eg-8v82a
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
summary: General entry ticket
2+
value:
3+
ticketType: general
4+
ticketDate: '2023-09-07'
5+
email: todd@example.com
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
summary: General entry ticket
2+
value:
3+
message: Museum general entry ticket purchased
4+
ticketId: 382c0820-0530-4f4b-99af-13811ad0f17a
5+
ticketType: general
6+
ticketDate: '2023-09-07'
7+
confirmationCode: ticket-general-e5e5c6-dce78

0 commit comments

Comments
 (0)