-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from mathew-jose/openapi-spec-examples
Added OpenAPI Spec Examples
- Loading branch information
Showing
1 changed file
with
113 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ paths: | |
properties: | ||
message: | ||
type: string | ||
example: 'Database populated.' | ||
/: | ||
get: | ||
tags: | ||
|
@@ -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: | ||
|
@@ -66,8 +72,10 @@ paths: | |
properties: | ||
email: | ||
type: string | ||
example: '[email protected]' | ||
username: | ||
type: string | ||
example: 'name1' | ||
/users/v1/_debug: | ||
get: | ||
tags: | ||
|
@@ -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: | ||
|
@@ -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': | ||
|
@@ -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: {} | ||
|
@@ -146,8 +163,10 @@ paths: | |
properties: | ||
username: | ||
type: string | ||
example: 'John.Doe' | ||
password: | ||
type: string | ||
example: 'password123' | ||
required: true | ||
responses: | ||
'200': | ||
|
@@ -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: | ||
|
@@ -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: | ||
|
@@ -190,6 +214,7 @@ paths: | |
required: true | ||
schema: | ||
type: string | ||
example: 'John.Doe' | ||
responses: | ||
'200': | ||
description: Successfully display user info | ||
|
@@ -202,8 +227,10 @@ paths: | |
properties: | ||
username: | ||
type: string | ||
example: 'John.Doe' | ||
email: | ||
type: string | ||
example: '[email protected]' | ||
'404': | ||
description: User not found | ||
content: | ||
|
@@ -214,8 +241,10 @@ paths: | |
status: | ||
type: string | ||
enum: ['fail'] | ||
example: 'fail' | ||
message: | ||
type: string | ||
example: 'User not found' | ||
|
||
delete: | ||
tags: | ||
|
@@ -230,6 +259,7 @@ paths: | |
required: true | ||
schema: | ||
type: string | ||
example: 'name1' | ||
responses: | ||
'200': | ||
description: Sucessfully deleted user | ||
|
@@ -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: | ||
|
@@ -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: | ||
|
@@ -272,6 +317,7 @@ paths: | |
required: true | ||
schema: | ||
type: string | ||
example: 'name1' | ||
requestBody: | ||
description: field to update | ||
content: | ||
|
@@ -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: | ||
|
@@ -299,8 +357,10 @@ paths: | |
status: | ||
type: string | ||
enum: ['fail'] | ||
example: 'fail' | ||
message: | ||
type: string | ||
example: 'Invalid Token' | ||
/users/v1/{username}/password: | ||
put: | ||
tags: | ||
|
@@ -315,6 +375,7 @@ paths: | |
required: true | ||
schema: | ||
type: string | ||
example: 'name1' | ||
requestBody: | ||
description: field to update | ||
content: | ||
|
@@ -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: | ||
|
@@ -342,8 +415,10 @@ paths: | |
status: | ||
type: string | ||
enum: ['fail'] | ||
example: 'fail' | ||
message: | ||
type: string | ||
example: 'Invalid Token' | ||
/books/v1: | ||
get: | ||
tags: | ||
|
@@ -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 | ||
|
@@ -385,8 +468,10 @@ paths: | |
properties: | ||
book_title: | ||
type: string | ||
example: 'book99' | ||
secret: | ||
type: string | ||
example: 'pass1secret' | ||
required: true | ||
responses: | ||
'200': | ||
|
@@ -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: | ||
|
@@ -414,8 +512,10 @@ paths: | |
status: | ||
type: string | ||
enum: ['fail'] | ||
example: 'fail' | ||
message: | ||
type: string | ||
example: 'Invalid Token' | ||
/books/v1/{book_title}: | ||
get: | ||
tags: | ||
|
@@ -432,6 +532,7 @@ paths: | |
required: true | ||
schema: | ||
type: string | ||
example: 'bookTitle77' | ||
responses: | ||
'200': | ||
description: Successfully retrieve book info | ||
|
@@ -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: | ||
|
@@ -458,8 +562,10 @@ paths: | |
status: | ||
type: string | ||
enum: ['fail'] | ||
example: 'fail' | ||
message: | ||
type: string | ||
example: 'Invalid Token' | ||
'404': | ||
description: Book not found | ||
content: | ||
|
@@ -470,6 +576,7 @@ paths: | |
status: | ||
type: string | ||
enum: ['fail'] | ||
example: 'fail' | ||
message: | ||
type: string | ||
|
||
example: 'Book not found!' |