Skip to content

Commit

Permalink
fix: replace backslashes with forward slashes in refs on Windows when…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
  • Loading branch information
tatomyr and JLekawa authored Feb 14, 2025
1 parent e1c065b commit 79b6460
Show file tree
Hide file tree
Showing 91 changed files with 2,337 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-dolls-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@redocly/cli": patch
---

Fixed a problem where the `split` command produced backslashes instead of forward slashes in `$ref`s on Windows.
2 changes: 1 addition & 1 deletion .github/workflows/smoke-plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Prepare Smoke
run: bash ./scripts/prepare-smoke-plugins.sh
run: bash ./__tests__/smoke-plugins/prepare-smoke-plugins.sh
- uses: actions/cache@v3
with:
path: __tests__/smoke-plugins/
Expand Down
24 changes: 16 additions & 8 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Prepare Smoke
run: bash ./scripts/prepare-smoke.sh
run: bash ./__tests__/smoke/prepare-smoke.sh
- uses: actions/cache@v3
with:
path: __tests__/smoke/
Expand Down Expand Up @@ -291,15 +291,23 @@ jobs:
run: docker build -t redocly/cli:latest .
- name: Run docker image
run: |
# Prepare
cp resources/pets.yaml resources/museum.yaml __tests__/smoke/
cd __tests__/smoke/
# Run commands
docker run --rm redocly/cli:latest --version
docker run --rm -v $PWD:/spec redocly/cli:latest lint openapi.yaml
docker run --rm -v $PWD:/spec redocly/cli:latest bundle openapi.yaml --ext json
docker run --rm -v $PWD:/spec redocly/cli:latest build-docs openapi.yaml
# Check for broken styles (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
if [[ "$(wc -l redoc-static.html)" == "324 redoc-static.html" ]]; then
echo "Docs built correctly."
else
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 324 lines in redoc-static.html)."
exit 1
fi
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
# Check for broken styles when building docs (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
echo "Checking docs for issues..."
diff pre-built/redoc.html redoc-static.html
echo "✅ Docs built correctly."
# Check for broken $refs (or other issues) in the split files, especially on Windows (it will fail on a difference)
echo "Checking split files for issues..."
diff -r pre-split output/split
echo "✅ Files split correctly."
File renamed without changes.
3 changes: 2 additions & 1 deletion __tests__/smoke/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"redocly-version": "redocly --version",
"redocly-lint": "redocly lint openapi.yaml",
"redocly-bundle": "redocly bundle openapi.yaml --ext json",
"redocly-build-docs": "redocly build-docs openapi.yaml"
"redocly-build-docs": "redocly build-docs openapi.yaml",
"redocly-split": "redocly split pets.yaml --outDir output/split/petstore && redocly split museum.yaml --outDir output/split/museum"
},
"author": "redocly",
"license": "ISC"
Expand Down
324 changes: 324 additions & 0 deletions __tests__/smoke/pre-built/redoc.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: Special event ticket
value:
ticketType: general
eventId: dad4bce8-f5cb-4078-a211-995864315e39
ticketDate: '2023-09-05'
email: [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
summary: Special event ticket
value:
message: Museum special event ticket purchased
ticketId: b811f723-17b2-44f7-8952-24b03e43d8a9
eventName: Mermaid Treasure Identification and Analysis
ticketType: event
ticketDate: '2023-09-05'
confirmationCode: ticket-event-9c55eg-8v82a
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
summary: General entry ticket
value:
ticketType: general
ticketDate: '2023-09-07'
email: [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
summary: General entry ticket
value:
message: Museum general entry ticket purchased
ticketId: 382c0820-0530-4f4b-99af-13811ad0f17a
ticketType: general
ticketDate: '2023-09-07'
confirmationCode: ticket-general-e5e5c6-dce78
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary: Create special event
value:
name: Mermaid Treasure Identification and Analysis
location: Under the seaaa 🦀 🎶 🌊.
eventDescription: >-
Join us as we review and classify a rare collection of 20 thingamabobs,
gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary: Special event created
value:
eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis
location: Under the seaaa 🦀 🎶 🌊.
eventDescription: >-
Join us as we review and classify a rare collection of 20 thingamabobs,
gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 30
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
summary: Get hours response
value:
- date: '2023-09-11'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-12'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-13'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-14'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-15'
timeOpen: '10:00'
timeClose: '16:00'
- date: '2023-09-18'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-19'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-20'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-21'
timeOpen: '09:00'
timeClose: '18:00'
- date: '2023-09-22'
timeOpen: '10:00'
timeClose: '16:00'
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
summary: Get special event
value:
eventId: 6744a0da-4121-49cd-8479-f8cc20526495
name: Time Traveler Tea Party
location: Temporal Tearoom
eventDescription: Sip tea with important historical figures.
dates:
- '2023-11-18'
- '2023-11-25'
- '2023-12-02'
price: 60
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
summary: List of special events
value:
- eventId: f3e0e76e-e4a8-466e-ab9c-ae36c15b8e97
name: Sasquatch Ballet
location: Seattle... probably
eventDescription: >-
They're big, they're hairy, but they're also graceful. Come learn how the
biggest feet can have the lightest touch.
dates:
- '2023-12-15'
- '2023-12-22'
price: 40
- eventId: 2f14374a-9c65-4ee5-94b7-fba66d893483
name: Solar Telescope Demonstration
location: Far from the sun.
eventDescription: Look at the sun without going blind!
dates:
- '2023-09-07'
- '2023-09-14'
price: 50
- eventId: 6aaa61ba-b2aa-4868-b803-603dbbf7bfdb
name: Cook like a Caveman
location: Fire Pit on East side
eventDescription: Learn to cook on an open flame.
dates:
- '2023-11-10'
- '2023-11-17'
- '2023-11-24'
price: 5
- eventId: 602b75e1-5696-4ab8-8c7a-f9e13580f910
name: Underwater Basket Weaving
location: Rec Center Pool next door.
eventDescription: Learn to weave baskets underwater.
dates:
- '2023-09-12'
- '2023-09-15'
price: 15
- eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis
location: Room Sea-12
eventDescription: >-
Join us as we review and classify a rare collection of 20 thingamabobs,
gadgets, gizmos, whoosits, and whatsits — kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 30
- eventId: 6744a0da-4121-49cd-8479-f8cc20526495
name: Time Traveler Tea Party
location: Temporal Tearoom
eventDescription: Sip tea with important historical figures.
dates:
- '2023-11-18'
- '2023-11-25'
- '2023-12-02'
price: 60
- eventId: 3be6453c-03eb-4357-ae5a-984a0e574a54
name: Pirate Coding Workshop
location: Computer Room
eventDescription: >-
Captain Blackbeard shares his love of the C...language. And possibly
Arrrrr (R lang).
dates:
- '2023-10-29'
- '2023-10-30'
- '2023-10-31'
price: 45
- eventId: 9d90d29a-2af5-4206-97d9-9ea9ceadcb78
name: Llama Street Art Through the Ages
location: Auditorium
eventDescription: Llama street art?! Alpaca my bags -- let's go!
dates:
- '2023-10-29'
- '2023-10-30'
- '2023-10-31'
price: 45
- eventId: a3c7b2c4-b5fb-4ef7-9322-00a919864957
name: The Great Parrot Debate
location: Outdoor Amphitheatre
eventDescription: See leading parrot minds discuss important geopolitical issues.
dates:
- '2023-11-03'
- '2023-11-10'
price: 35
- eventId: b92d46b7-4c5d-422b-87a5-287767e26f29
name: Eat a Bunch of Corn
location: Cafeteria
eventDescription: We accidentally bought too much corn. Please come eat it.
dates:
- '2023-11-10'
- '2023-11-17'
- '2023-11-24'
price: 5
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
summary: Update special event request
value:
location: On the beach.
price: 15
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
summary: Update special event
value:
eventId: dad4bce8-f5cb-4078-a211-995864315e39
name: Mermaid Treasure Identification and Analysis
location: On the beach.
eventDescription: >-
Join us as we review and classify a rare collection of 20 thingamabobs,
gadgets, gizmos, whoosits, and whatsits, kindly donated by Ariel.
dates:
- '2023-09-05'
- '2023-09-08'
price: 15
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: endDate
in: query
description: >-
End of a date range to retrieve special events for. Defaults to 7 days after
`startDate`.
schema:
type: string
format: date
example: '2023-04-18'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: eventId
in: path
description: Identifier for a special event.
required: true
schema:
type: string
format: uuid
example: dad4bce8-f5cb-4078-a211-995864315e39
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: limit
in: query
description: Number of days per page.
schema:
type: integer
default: 10
maximum: 30
example: 15
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: page
in: query
description: Page number to retrieve.
schema:
type: integer
default: 1
example: 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: startDate
in: query
description: >-
Starting date to retrieve future operating hours from. Defaults to today's
date.
schema:
type: string
format: date
example: '2023-02-23'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: ticketId
in: path
description: Identifier for a ticket to a museum event. Used to generate ticket image.
required: true
schema:
type: string
format: uuid
example: a54a57ca-36f8-421b-a6b4-2e8f26858a4c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Bad request.
content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Not found.
content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: Unauthorized.
content:
application/problem+json:
schema:
$ref: ../schemas/Error.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
description: Request payload used for purchasing museum tickets.
type: object
properties:
ticketType:
$ref: ./TicketType.yaml
eventId:
description: >-
Unique identifier for a special event. Required if purchasing tickets for
the museum's special events.
$ref: ./EventId.yaml
ticketDate:
description: Date that the ticket is valid for.
$ref: ./Date.yaml
email:
$ref: ./Email.yaml
phone:
$ref: ./Phone.yaml
required:
- ticketType
- ticketDate
- email
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
description: Details for a museum ticket after a successful purchase.
type: object
properties:
message:
$ref: ./TicketMessage.yaml
eventName:
$ref: ./EventName.yaml
ticketId:
$ref: ./TicketId.yaml
ticketType:
$ref: ./TicketType.yaml
ticketDate:
description: Date the ticket is valid for.
$ref: ./Date.yaml
confirmationCode:
$ref: ./TicketConfirmation.yaml
required:
- message
- ticketId
- ticketType
- ticketDate
- confirmationCode
Loading

1 comment on commit 79b6460

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 78.54% 5062/6445
🟡 Branches 67.24% 2065/3071
🟡 Functions 73.2% 836/1142
🟡 Lines 78.82% 4775/6058

Test suite run success

839 tests passing in 121 suites.

Report generated by 🧪jest coverage report action from 79b6460

Please sign in to comment.