Skip to content

Commit

Permalink
docs: update "Swagger UI" section in README (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-baiborodine authored Oct 15, 2023
1 parent e712789 commit 1a323d8
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 52 deletions.
106 changes: 54 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ the `Request Body` text area, and click on the `Execute`:

```json
{
"uuid": "8db6b1f4-27ba-11eb-adc1-0242ac120001",
"email": "[email protected]",
"fullName": "John Smith 1",
"startDate": "2022-08-21",
"endDate": "2022-08-23",
"campsiteId": "1"
"campsiteId": 1,
"email": "John Smith",
"fullName": "[email protected]",
"startDate": "2023-10-29",
"endDate": "2023-10-30",
"active": true
}
```
![Swagger UI Add Booking 1](/readme/swagger-add-booking-1.png)
Expand All @@ -161,68 +161,70 @@ Execute the [create-bookings.sh](concurrent-test/create-bookings.sh) script to s
booking creation for the same booking dates:

```bash
$ concurrent-test/create-bookings.sh 2022-09-16 2022-09-17 http:/localhost:80
$ concurrent-test/create-bookings.sh 2023-10-16 2023-10-17 http:/localhost:80
```
The response should be as follows after formatting, i.e., only one booking was created:
```json
{
"id":2,
"version":0,
"campsiteId":1,
"uuid":"ea2e2f8f-749d-4497-b0ec-0da4bf437800",
"email":"[email protected]",
"fullName":"John Smith 3",
"startDate":"2022-09-16",
"endDate":"2022-09-17",
"active":true,
"_links":{
"self":{
"href":"http://localhost/v2/booking/ea2e2f8f-749d-4497-b0ec-0da4bf437800"
[
{
"status": "BAD_REQUEST",
"timestamp": "2023-10-15T16:36:53.563620238",
"message": "No vacant dates available from 2023-10-16 to 2023-10-17"
},
{
"status": "BAD_REQUEST",
"timestamp": "2023-10-15T16:36:53.568417093",
"message": "No vacant dates available from 2023-10-16 to 2023-10-17"
},
{
"uuid": "870cdaaa-592e-4f9e-92e4-8168f7d427b7",
"version": 0,
"campsiteId": 1,
"email": "[email protected]",
"fullName": "John Smith 3",
"startDate": "2023-10-16",
"endDate": "2023-10-17",
"active": true,
"_links": {
"self": {
"href": "http://localhost:8080/v2/booking/870cdaaa-592e-4f9e-92e4-8168f7d427b7"
}
}
}
{
"status":"BAD_REQUEST",
"timestamp":"2022-08-30T02:52:19.10936",
"message":"No vacant dates available from 2022-09-16 to 2022-09-17"
}
{
"status":"BAD_REQUEST",
"timestamp":"2022-08-30T02:52:19.210229",
"message":"No vacant dates available from 2022-09-16 to 2022-09-17"
}
}
}
]
```

#### Booking Update
Execute the [update-booking.sh](concurrent-test/update-booking.sh) script to simulate concurrent
updates for the same booking:

```bash
$ concurrent-test/update-booking.sh 2022-09-16 2022-09-17 http:/localhost:80
$ concurrent-test/update-booking.sh 2022-10-25 2022-10-26 http:/localhost:80
```
The response should be as follows after formatting, i.e., only one booking was updated:
```json
{
"id": 16,
"uuid": "fb79da99-0189-417c-b3de-e91c827151c7",
"version": 1,
"campsiteId": 2,
"email": "[email protected]",
"fullName": "John Smith 1",
"startDate": "2022-09-16",
"endDate": "2022-09-17",
"active": true,
"_links": {
"self": {
"href": "http://localhost/v2/booking/fb79da99-0189-417c-b3de-e91c827151c7"
[
{
"uuid": "cbf91bf1-c533-4c3d-a9c5-c1e3b0396306",
"version": 0,
"campsiteId": 3,
"email": "[email protected]",
"fullName": "John Smith 1",
"startDate": "2023-10-25",
"endDate": "2023-10-26",
"active": true,
"_links": {
"self": {
"href": "http://localhost:8080/v2/booking/cbf91bf1-c533-4c3d-a9c5-c1e3b0396306"
}
}
},
{
"status": "CONFLICT",
"timestamp": "2023-10-15T17:04:18.606047801",
"message": "Optimistic locking error - booking was updated by another transaction"
}
}
{
"status": "CONFLICT",
"timestamp": "2022-08-30T11:57:26.956261999",
"message": "Optimistic locking error - booking was updated by another transaction"
}
]
```

### Basic Load Testing
Expand Down
Binary file modified readme/swagger-add-booking-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified readme/swagger-add-booking-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified readme/swagger-main-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1a323d8

Please sign in to comment.