Skip to content

Commit

Permalink
Update swagger.yml url
Browse files Browse the repository at this point in the history
  • Loading branch information
tsheporamantso committed Mar 7, 2024
1 parent c9cf9c9 commit 2466b2c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 46 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Make sure you setup and run the back-end first.
Install this project with:

```sh
npm install
bundle install
```

```sh
Expand All @@ -112,7 +112,15 @@ Install this project with:
To run the project, execute the following command:

```sh
npm start
rails server

```
### Test

To test API documentation please visit below url:

```sh
http://localhost:3000/api-docs/index.html
```


Expand Down
67 changes: 23 additions & 44 deletions swagger/v1/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
title: API V1
version: v1
paths:
"/api/v1/places":
"/api/v1/users/{id}/places":
post:
summary: Creates a place
tags:
Expand All @@ -25,6 +25,8 @@ paths:
type: string
photo:
type: string
pricepernight:
type: number
location:
type: string
rate:
Expand All @@ -43,6 +45,12 @@ paths:
summary: Retrieves all places
tags:
- Places
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: places found
Expand All @@ -57,6 +65,8 @@ paths:
type: integer
description:
type: string
pricepernight:
type: number
photo:
type: string
location:
Expand All @@ -74,7 +84,7 @@ paths:
- rate
- user_id
- address
"/api/v1/places/{id}":
"/api/v1/users/{id}/places/{place_id}":
get:
summary: Retrieves a place
tags:
Expand All @@ -85,6 +95,11 @@ paths:
required: true
schema:
type: string
- name: place_id
in: path
required: true
schema:
type: string
responses:
'200':
description: place found
Expand All @@ -97,6 +112,8 @@ paths:
type: integer
description:
type: string
pricepernight:
type: number
photo:
type: string
location:
Expand All @@ -116,45 +133,7 @@ paths:
- address
'404':
description: place not found
put:
summary: Updates a place
tags:
- Places
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: place updated
'422':
description: invalid request
requestBody:
content:
application/json:
schema:
type: object
properties:
description:
type: string
photo:
type: string
location:
type: string
rate:
type: number
user_id:
type: number
address:
type: string
required:
- description
- location
- rate
- user_id
- address
"/api/v1/users/{id}/places/{id}":
delete:
summary: Deletes a place
tags:
Expand All @@ -166,7 +145,7 @@ paths:
schema:
type: string
responses:
'200':
'204':
description: place deleted
'404':
description: place not found
Expand Down Expand Up @@ -345,7 +324,7 @@ paths:
'404':
description: reservation not found
servers:
- url: https://{defaultHost}
- url: http://{defaultHost}
variables:
defaultHost:
default: www.example.com
default: localhost:3000

0 comments on commit 2466b2c

Please sign in to comment.