-
Notifications
You must be signed in to change notification settings - Fork 41
Add HTTP REST API for Hotel Room Reservation use case #198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add HTTP REST API for Hotel Room Reservation use case #198
Conversation
Update Migration Tools link to point to the overview page
Add HTTP REST API for Hotel Room Reservation use case and related images
Enhance HTTP REST API documentation with additional configuration details and new resource images
WalkthroughNavigation links updated in documentation indexes to point to migration tools overview. New documentation guide added for building HTTP REST APIs for hotel reservations using WSO2 Integrator, including resource definitions, endpoint specifications, and implementation workflow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
en/docs/integration-guides/usecases/http/building-http-rest-api-for-hotel-reservation.md
Outdated
Show resolved
Hide resolved
en/docs/integration-guides/usecases/http/building-http-rest-api-for-hotel-reservation.md
Outdated
Show resolved
Hide resolved
en/docs/integration-guides/usecases/http/building-http-rest-api-for-hotel-reservation.md
Outdated
Show resolved
Hide resolved
en/docs/integration-guides/usecases/http/building-http-rest-api-for-hotel-reservation.md
Outdated
Show resolved
Hide resolved
en/docs/integration-guides/usecases/http/building-http-rest-api-for-hotel-reservation.md
Outdated
Show resolved
Hide resolved
en/docs/integration-guides/usecases/http/building-http-rest-api-for-hotel-reservation.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (2)
en/docs/integration-guides/usecases/http/build-an-http-rest-api-for-hotel-reservation.md (2)
168-169: Standardize heading style: use atx (###) instead of setext.Line 168 uses a setext-style heading (underline with dashes), which is inconsistent with the atx-style headers (
##) used elsewhere in the document.Replace the setext heading with the atx style:
-### Edit reservation resource (PUT) - -1. **Resource Path**: `reservations/[string id]` +### Edit reservation resource (PUT) -1. **Resource Path**: `reservations/[string id]`
175-185: Standardize resource path notation for consistency.Line 177 uses
reservations/[string id]notation for path parameters, while earlier examples (line 20) use the standard REST convention{id}. Use curly braces consistently throughout.Apply this diff to align with standard REST notation:
-1. **Resource Path**: `reservations/[string id]` +1. **Resource Path**: `reservations/{id}`Then apply the same change to line 183 (
reservations/[string id]→reservations/{id}).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
en/docs/integration-guides/usecases/http/build-an-http-rest-api-for-hotel-reservation.md(1 hunks)en/mkdocs.yml(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- en/mkdocs.yml
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
en/docs/integration-guides/usecases/http/build-an-http-rest-api-for-hotel-reservation.md
58-58: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
67-67: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
81-81: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
92-92: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
104-104: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
168-168: Heading style
Expected: atx; Actual: setext
(MD003, heading-style)
198-198: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
217-217: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
236-236: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
265-265: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (2)
en/docs/integration-guides/usecases/http/build-an-http-rest-api-for-hotel-reservation.md (2)
1-345: Content structure and comprehensiveness look solid.The documentation provides a well-organized, step-by-step guide with clear explanations of REST principles, practical examples, and a realistic hotel reservation workflow. The use of JSON examples, curl commands, and accompanying GIFs enhances understanding.
45-45: Verify image asset paths exist in documentation output.The document references GIF images at lines 45, 113, 150, 168, and 187 using the path pattern
{{base_path}}/assets/usecases/http-reservation/img/. Ensure these image files exist in the assets directory, or the documentation links will break.
| **Type: Location** | ||
| ```json | ||
| { | ||
| "name": "Alps Resort", | ||
| "id": "l1000", | ||
| "address": "123 Mountain Road, Switzerland" | ||
| } | ||
| ``` | ||
|
|
||
| **Type: Room** | ||
| ```json | ||
| { | ||
| "id": "r1000", | ||
| "category": "DELUXE", | ||
| "capacity": 5, | ||
| "wifi": true, | ||
| "status": "AVAILABLE", | ||
| "currency": "USD", | ||
| "price": 200.00, | ||
| "count": 3 | ||
| } | ||
| ``` | ||
|
|
||
| **Type: ReservationRequest** | ||
| ```json | ||
| { | ||
| "reserveRooms": [ | ||
| {"id": "r1000", "count": 2} | ||
| ], | ||
| "startDate": "2025-08-01", | ||
| "endDate": "2025-08-03" | ||
| } | ||
| ``` | ||
|
|
||
| **Type: ReservationReceipt** | ||
| ```json | ||
| { | ||
| "id": "re1000", | ||
| "expiryDate": "2025-07-01", | ||
| "lastUpdated": "2025-06-29T13:01:30Z", | ||
| "currency": "USD", | ||
| "total": 400.00, | ||
| "state": "VALID" | ||
| } | ||
| ``` | ||
|
|
||
| **Type: Payment** | ||
| ```json | ||
| { | ||
| "cardNumber": "1234567890123456", | ||
| "expiryDate": "12/27", | ||
| "cvv": "123" | ||
| } | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Fix markdown formatting: use headings instead of emphasis for data type definitions.
Lines 58, 67, 81, 92, and 104 use bold text (**Type: ...**) instead of proper markdown headers. This affects document structure and linting compliance.
Apply this diff to use proper markdown headers:
-**Type: Location**
+### Type: LocationThen apply the same pattern to lines 67 (**Type: Room**), 81 (**Type: ReservationRequest**), 92 (**Type: ReservationReceipt**), and 104 (**Type: Payment**).
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
58-58: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
67-67: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
81-81: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
92-92: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
104-104: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🤖 Prompt for AI Agents
In
en/docs/integration-guides/usecases/http/build-an-http-rest-api-for-hotel-reservation.md
around lines 58 to 112, the data type labels currently use bold formatting
(e.g., **Type: Location**) which breaks document structure and linting; replace
each bold label at lines 58, 67, 81, 92, and 104 with a proper markdown header
(for example a level-3 header like ### Type: Location) so each type is a real
heading, leaving the JSON blocks unchanged and ensuring consistent header level
for all five occurrences.
| **1. Start at the entry point** | ||
|
|
||
| ```bash | ||
| curl http://localhost:8290/hotel/locations | ||
| ``` | ||
|
|
||
| Response includes link to rooms: | ||
| ```json | ||
| { | ||
| "locations": [...], | ||
| "_links": { | ||
| "room": { | ||
| "href": "/hotel/locations/{id}/rooms", | ||
| "methods": ["GET"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **2. Follow the "room" link** | ||
|
|
||
| ```bash | ||
| curl "http://localhost:8290/hotel/locations/l1000/rooms?startDate=2025-08-01&endDate=2025-08-03" | ||
| ``` | ||
|
|
||
| Response includes link to make reservation: | ||
| ```json | ||
| { | ||
| "rooms": [...], | ||
| "_links": { | ||
| "reservation": { | ||
| "href": "/hotel/reservations", | ||
| "methods": ["POST"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **3. Follow the "reservation" link** | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8290/hotel/reservations \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "reserveRooms": [{"id": "r1000", "count": 2}], | ||
| "startDate": "2025-08-01", | ||
| "endDate": "2025-08-03" | ||
| }' | ||
| ``` | ||
|
|
||
| Response includes links to cancel, edit, or pay: | ||
| ```json | ||
| { | ||
| "id": "re1000", | ||
| "total": 400.00, | ||
| "state": "VALID", | ||
| "_links": { | ||
| "cancel": {...}, | ||
| "edit": {...}, | ||
| "payment": { | ||
| "href": "/hotel/payments/re1000", | ||
| "methods": ["POST"] | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| **4. Follow the "payment" link to complete** | ||
|
|
||
| ```bash | ||
| curl -X POST http://localhost:8290/hotel/payments/re1000 \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ | ||
| "cardNumber": "1234567890123456", | ||
| "expiryDate": "12/27", | ||
| "cvv": "123" | ||
| }' | ||
| ``` | ||
|
|
||
| Response has no links (workflow complete): | ||
| ```json | ||
| { | ||
| "id": "p1000", | ||
| "total": 400.00, | ||
| "rooms": [{"id": "r1000", "status": "RESERVED"}] | ||
| } | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Fix markdown formatting: use headings for test workflow section headers.
Lines 198, 217, 236, and 265 use bold text (**1. Start at the entry point**, etc.) instead of proper markdown headers for subsection titles.
Replace emphasis with markdown headers:
-**1. Start at the entry point**
+### 1. Start at the entry pointApply the same pattern to lines 217 (**2. Follow the "room" link**), 236 (**3. Follow the "reservation" link**), and 265 (**4. Follow the "payment" link to complete**).
Committable suggestion skipped: line range outside the PR's diff.
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
198-198: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
217-217: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
236-236: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
265-265: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🤖 Prompt for AI Agents
In
en/docs/integration-guides/usecases/http/build-an-http-rest-api-for-hotel-reservation.md
around lines 198 to 284, the subsection titles currently use bolded text (e.g.,
"**1. Start at the entry point**") instead of markdown headers; replace those
bold lines at 198, 217, 236, and 265 with appropriate markdown headers (e.g.,
"### 1. Start at the entry point", "### 2. Follow the \"room\" link", "### 3.
Follow the \"reservation\" link", "### 4. Follow the \"payment\" link to
complete") so they render as section headings while keeping the surrounding code
blocks and example JSON unchanged.
Purpose
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.