Skip to content

Commit

Permalink
Merge pull request #36 from mathew-jose/openapi-spec-examples
Browse files Browse the repository at this point in the history
Added OpenAPI Spec Examples
  • Loading branch information
erev0s committed Apr 9, 2023
2 parents 9392f22 + 768587b commit 999e10e
Showing 1 changed file with 113 additions and 6 deletions.
119 changes: 113 additions & 6 deletions openapi_specs/openapi3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ paths:
properties:
message:
type: string
example: 'Database populated.'
/:
get:
tags:
Expand All @@ -45,8 +46,13 @@ paths:
properties:
message:
type: string
Help:
example: 'VAmPI the Vulnerable API'
help:
type: string
example: 'VAmPI is a vulnerable on purpose API. It was created in order to evaluate the efficiency of third party tools in identifying vulnerabilities in APIs but it can also be used in learning/teaching purposes.'
vulnerable:
type: number
example: 1
/users/v1:
get:
tags:
Expand All @@ -66,8 +72,10 @@ paths:
properties:
email:
type: string
example: '[email protected]'
username:
type: string
example: 'name1'
/users/v1/_debug:
get:
tags:
Expand All @@ -87,12 +95,16 @@ paths:
properties:
admin:
type: boolean
example: false
email:
type: string
example: '[email protected]'
password:
type: string
example: 'pass1'
username:
type: string
example: 'name1'
/users/v1/register:
post:
tags:
Expand All @@ -109,10 +121,13 @@ paths:
properties:
username:
type: string
example: 'John.Doe'
password:
type: string
example: 'password123'
email:
type: string
example: '[email protected]'
required: true
responses:
'200':
Expand All @@ -124,9 +139,11 @@ paths:
properties:
message:
type: string
example: 'Successfully registered. Login to receive an auth token.'
status:
type: string
enum: ['success', 'fail']
example: 'success'
'400':
description: Invalid request
content: {}
Expand All @@ -146,8 +163,10 @@ paths:
properties:
username:
type: string
example: 'John.Doe'
password:
type: string
example: 'password123'
required: true
responses:
'200':
Expand All @@ -159,11 +178,14 @@ paths:
properties:
auth_token:
type: string
example: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzAxNjA2MTcsImlhdCI6MTY3MDE2MDU1Nywic3ViIjoiSm9obi5Eb2UifQ.n17N4AxTbL4_z65-NR46meoytauPDjImUxrLiUMSTQw'
message:
type: string
example: 'Successfully logged in.'
status:
type: string
enum: ['success', 'fail']
example: 'success'
'400':
description: Invalid request
content:
Expand All @@ -174,8 +196,10 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Password is not correct for the given username.'
/users/v1/{username}:
get:
tags:
Expand All @@ -190,6 +214,7 @@ paths:
required: true
schema:
type: string
example: 'John.Doe'
responses:
'200':
description: Successfully display user info
Expand All @@ -202,8 +227,10 @@ paths:
properties:
username:
type: string
example: 'John.Doe'
email:
type: string
example: '[email protected]'
'404':
description: User not found
content:
Expand All @@ -214,8 +241,10 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'User not found'

delete:
tags:
Expand All @@ -230,6 +259,7 @@ paths:
required: true
schema:
type: string
example: 'name1'
responses:
'200':
description: Sucessfully deleted user
Expand All @@ -240,9 +270,11 @@ paths:
properties:
message:
type: string
example: 'User deleted.'
status:
type: string
enum: ['success', 'fail']
example: 'success'
'401':
description: User not authorized
content:
Expand All @@ -252,12 +284,25 @@ paths:
properties:
status:
type: string
example: 'fail'
enum: ['fail']
message:
type: string
example: 'Only Admins may delete users!'
'404':
description: User not found
content: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: 'fail'
enum: ['fail']
message:
type: string
example: 'User not found!'
/users/v1/{username}/email:
put:
tags:
Expand All @@ -272,6 +317,7 @@ paths:
required: true
schema:
type: string
example: 'name1'
requestBody:
description: field to update
content:
Expand All @@ -281,14 +327,26 @@ paths:
properties:
email:
type: string
example: '[email protected]'
required: true
responses:
'204':
description: Sucessfully updated user email
content: {}
'400':
description: Invalid request
content: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Please Provide a valid email address.'
'401':
description: User not authorized
content:
Expand All @@ -299,8 +357,10 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Invalid Token'
/users/v1/{username}/password:
put:
tags:
Expand All @@ -315,6 +375,7 @@ paths:
required: true
schema:
type: string
example: 'name1'
requestBody:
description: field to update
content:
Expand All @@ -324,14 +385,26 @@ paths:
properties:
password:
type: string
example: 'pass4'
required: true
responses:
'204':
description: Sucessfully updated users password
content: {}
'400':
description: Invalid request
content: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Malformed Data'
'401':
description: User not authorized
content:
Expand All @@ -342,8 +415,10 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Invalid Token'
/books/v1:
get:
tags:
Expand All @@ -368,6 +443,14 @@ paths:
type: string
user:
type: string
example:
Books:
- book_title: 'bookTitle77'
user: 'name1'
- book_title: 'bookTitle85'
user: 'name2'
- book_title: 'bookTitle47'
user: 'admin'
post:
tags:
- books
Expand All @@ -385,8 +468,10 @@ paths:
properties:
book_title:
type: string
example: 'book99'
secret:
type: string
example: 'pass1secret'
required: true
responses:
'200':
Expand All @@ -398,12 +483,25 @@ paths:
properties:
message:
type: string
example: 'Book has been added.'
status:
type: string
enum: ['success', 'fail']
example: 'success'
'400':
description: Invalid request
content: {}
content:
application/json:
schema:
type: object
properties:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Book Already exists!'
'401':
description: User not authorized
content:
Expand All @@ -414,8 +512,10 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Invalid Token'
/books/v1/{book_title}:
get:
tags:
Expand All @@ -432,6 +532,7 @@ paths:
required: true
schema:
type: string
example: 'bookTitle77'
responses:
'200':
description: Successfully retrieve book info
Expand All @@ -444,10 +545,13 @@ paths:
properties:
book_title:
type: string
example: 'bookTitle77'
owner:
type: string
example: 'name1'
secret:
type: string
example: 'secret for bookTitle77'
'401':
description: User not authorized
content:
Expand All @@ -458,8 +562,10 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string
example: 'Invalid Token'
'404':
description: Book not found
content:
Expand All @@ -470,6 +576,7 @@ paths:
status:
type: string
enum: ['fail']
example: 'fail'
message:
type: string

example: 'Book not found!'

0 comments on commit 999e10e

Please sign in to comment.