more updates to swagger docs
This commit is contained in:
92
swagger.yml
92
swagger.yml
@@ -1,17 +1,51 @@
|
|||||||
openapi: 3.0.0
|
openapi: 3.0.0
|
||||||
|
|
||||||
info:
|
info:
|
||||||
description: "Codecademy e-commerce REST API"
|
description: "The REST API for my demo e-commerce app, based on various herb and spice online shopping platforms."
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
title: "E-commerce REST API"
|
title: "Mikayla's Spice Shop, REST API"
|
||||||
|
|
||||||
schemes:
|
schemes:
|
||||||
- http
|
- http
|
||||||
|
|
||||||
|
servers:
|
||||||
|
- url: localhost:8088
|
||||||
|
description: The URL which currently hosts the REST API
|
||||||
|
|
||||||
host: localhost:4000
|
host: localhost:4000
|
||||||
|
|
||||||
basePath: "/"
|
basePath: "/"
|
||||||
|
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
User:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
firstname?:
|
||||||
|
type: string
|
||||||
|
lastname?:
|
||||||
|
type: string
|
||||||
|
securitySchemas:
|
||||||
|
BasicAuth:
|
||||||
|
type: http
|
||||||
|
scheme: basic
|
||||||
|
OAuth2:
|
||||||
|
type: oauth2
|
||||||
|
flows:
|
||||||
|
authorizationCode:
|
||||||
|
authorizationUrl: ''
|
||||||
|
tokenUrl: ''
|
||||||
|
scopes:
|
||||||
|
read: ''
|
||||||
|
write: ''
|
||||||
|
admin: ''
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
- name: auth
|
- name: auth
|
||||||
description: "Handles user authentication workflows, including login and new user registration."
|
description: "Handles user authentication workflows, including login and new user registration."
|
||||||
@@ -28,30 +62,80 @@ paths:
|
|||||||
/auth/register:
|
/auth/register:
|
||||||
post:
|
post:
|
||||||
summary: "New user registration"
|
summary: "New user registration"
|
||||||
description: "New user registration"
|
description: "Takes the request body and uses its data to create and insert a new user record into the database."
|
||||||
tags:
|
tags:
|
||||||
- auth
|
- auth
|
||||||
produces:
|
produces:
|
||||||
- "application/json"
|
- "application/json"
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
description: 200 Success
|
description: "Request was successful"
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
409:
|
||||||
|
description: "An entry conflicting with this input already exists in the database."
|
||||||
schema:
|
schema:
|
||||||
type: object
|
type: object
|
||||||
/auth/login:
|
/auth/login:
|
||||||
post:
|
post:
|
||||||
summary: "Login and get user account info"
|
summary: "Login and get user account info"
|
||||||
|
description: "Check the user input and, if it matches with the record in the database, login the user and open or update a user session."
|
||||||
tags:
|
tags:
|
||||||
- auth
|
- auth
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "Successful login, returns user data from database"
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/User'
|
||||||
|
401:
|
||||||
|
description: "Incorrect username or password"
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
/cart/{userid}:
|
/cart/{userid}:
|
||||||
get:
|
get:
|
||||||
summary: "Get the contents of a given user's cart"
|
summary: "Get the contents of a given user's cart"
|
||||||
|
parameters:
|
||||||
|
- name: userid
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: "The user ID of the cart to be located, if it exists."
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
tags:
|
tags:
|
||||||
- cart
|
- cart
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "Cart located successfully"
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
404:
|
||||||
|
description: "Cart was not found"
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
put:
|
put:
|
||||||
summary: "Update a given user's cart"
|
summary: "Update a given user's cart"
|
||||||
|
parameters:
|
||||||
|
- name: userid
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
description: "The user ID of the cart to be located, if it exists."
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
minimum: 1
|
||||||
tags:
|
tags:
|
||||||
- cart
|
- cart
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "Cart update successful"
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
400:
|
||||||
|
description: "Bad request"
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
/orders:
|
/orders:
|
||||||
get:
|
get:
|
||||||
summary: "Get all records of all orders"
|
summary: "Get all records of all orders"
|
||||||
|
|||||||
Reference in New Issue
Block a user