-
Notifications
You must be signed in to change notification settings - Fork 0
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 #34 from ywalakamar/chore/host-swagger-api-doc-gh-…
…pages Host the API docs in Github Pages
- Loading branch information
Showing
14 changed files
with
477 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -80,7 +80,7 @@ typings/ | |
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
#dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!doctype html> | ||
<html lang="en-US"> | ||
<title>Swagger UI: OAuth2 Redirect</title> | ||
<body onload="run()"> | ||
</body> | ||
</html> | ||
<script> | ||
'use strict'; | ||
function run () { | ||
var oauth2 = window.opener.swaggerUIRedirectOauth2; | ||
var sentState = oauth2.state; | ||
var redirectUrl = oauth2.redirectUrl; | ||
var isValid, qp, arr; | ||
|
||
if (/code|token|error/.test(window.location.hash)) { | ||
qp = window.location.hash.substring(1); | ||
} else { | ||
qp = location.search.substring(1); | ||
} | ||
|
||
arr = qp.split("&") | ||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';}) | ||
qp = qp ? JSON.parse('{' + arr.join() + '}', | ||
function (key, value) { | ||
return key === "" ? value : decodeURIComponent(value) | ||
} | ||
) : {} | ||
|
||
isValid = qp.state === sentState | ||
|
||
if (( | ||
oauth2.auth.schema.get("flow") === "accessCode"|| | ||
oauth2.auth.schema.get("flow") === "authorizationCode" | ||
) && !oauth2.auth.code) { | ||
if (!isValid) { | ||
oauth2.errCb({ | ||
authId: oauth2.auth.name, | ||
source: "auth", | ||
level: "warning", | ||
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server" | ||
}); | ||
} | ||
|
||
if (qp.code) { | ||
delete oauth2.state; | ||
oauth2.auth.code = qp.code; | ||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl}); | ||
} else { | ||
let oauthErrorMsg | ||
if (qp.error) { | ||
oauthErrorMsg = "["+qp.error+"]: " + | ||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") + | ||
(qp.error_uri ? "More info: "+qp.error_uri : ""); | ||
} | ||
|
||
oauth2.errCb({ | ||
authId: oauth2.auth.name, | ||
source: "auth", | ||
level: "error", | ||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server" | ||
}); | ||
} | ||
} else { | ||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl}); | ||
} | ||
window.close(); | ||
} | ||
</script> |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!-- HTML for static distribution bundle build --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Auctioneer API Docs</title> | ||
<link rel="stylesheet" type="text/css" href="./dist/swagger-ui.css" > | ||
<link rel="icon" type="image/png" href="./dist/favicon-32x32.png" sizes="32x32" /> | ||
<link rel="icon" type="image/png" href="./dist/favicon-16x16.png" sizes="16x16" /> | ||
<style> | ||
html | ||
{ | ||
box-sizing: border-box; | ||
overflow: -moz-scrollbars-vertical; | ||
overflow-y: scroll; | ||
} | ||
|
||
*, | ||
*:before, | ||
*:after | ||
{ | ||
box-sizing: inherit; | ||
} | ||
|
||
body | ||
{ | ||
margin:0; | ||
background: #fafafa; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="swagger-ui"></div> | ||
|
||
<script src="./dist/swagger-ui-bundle.js"> </script> | ||
<script src="./dist/swagger-ui-standalone-preset.js"> </script> | ||
<script> | ||
window.onload = function() { | ||
// Begin Swagger UI call region | ||
const ui = SwaggerUIBundle({ | ||
url: "swagger.json", | ||
dom_id: '#swagger-ui', | ||
deepLinking: true, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
], | ||
plugins: [ | ||
SwaggerUIBundle.plugins.DownloadUrl | ||
], | ||
layout: "StandaloneLayout" | ||
}) | ||
// End Swagger UI call region | ||
|
||
window.ui = ui | ||
} | ||
</script> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -0,0 +1,175 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"description": "An Auctioneering System API documetation by Kipruto Barno", | ||
"version": "1.0.0", | ||
"title": "Auctioneering System", | ||
"contact": { | ||
"email": "[email protected]" | ||
}, | ||
"license": { | ||
"name": "MIT", | ||
"url": "https://opensource.org/licenses/MIT" | ||
} | ||
}, | ||
"host": "e25af10e.ngrok.io", | ||
"basePath": "/api/v1", | ||
"schemes": ["https"], | ||
"securityDefinitions": { | ||
"Bearer": { | ||
"type": "apiKey", | ||
"name": "Authorization", | ||
"in": "header" | ||
} | ||
}, | ||
"paths": { | ||
"/register": { | ||
"post": { | ||
"tags": ["Register"], | ||
"summary": "Create user", | ||
"description": "Creates the auctioneering system administrator", | ||
"operationId": "createUser", | ||
"produces": ["application/json"], | ||
"parameters": [ | ||
{ | ||
"in": "body", | ||
"name": "body", | ||
"description": "User registration request body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/User" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"201": { | ||
"description": "Created" | ||
}, | ||
"409": { | ||
"description": "User already registered" | ||
} | ||
} | ||
} | ||
}, | ||
"/login": { | ||
"post": { | ||
"tags": ["Login"], | ||
"summary": "User login", | ||
"description": "System administrator user login", | ||
"operationId": "loginUser", | ||
"produces": ["application/json"], | ||
"parameters": [ | ||
{ | ||
"in": "body", | ||
"name": "body", | ||
"description": "User login request body", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/User" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"200": { | ||
"description": "Success" | ||
}, | ||
"400": { | ||
"description": "Missing email or password" | ||
} | ||
} | ||
} | ||
}, | ||
"/owners": { | ||
"get": { | ||
"security": [ | ||
{ | ||
"Bearer": [] | ||
} | ||
], | ||
"tags": ["Get Owners"], | ||
"summary": "Get all owners", | ||
"description": "Retrieves all registered item owners", | ||
"operationId": "getOwners", | ||
"produces": ["application/json"], | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
}, | ||
"401": { | ||
"description": "Unauthorized" | ||
} | ||
} | ||
}, | ||
"post": { | ||
"security": [ | ||
{ | ||
"Bearer": [] | ||
} | ||
], | ||
"tags": ["Create Owner"], | ||
"summary": "Create owner", | ||
"description": "Creates the owner of the items to be auctioned", | ||
"operationId": "CreateOwner", | ||
"produces": ["application/json"], | ||
"parameters": [ | ||
{ | ||
"in": "body", | ||
"name": "body", | ||
"description": "Created user object", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/definitions/Owner" | ||
} | ||
} | ||
], | ||
"responses": { | ||
"201": { | ||
"description": "Created" | ||
}, | ||
"401": { | ||
"description": "Unauthorized" | ||
}, | ||
"409": { | ||
"description": "Owner already registered" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"definitions": { | ||
"User": { | ||
"title": "User", | ||
"description": "A User who manages the Auctioneer System", | ||
"type": "object", | ||
"properties": { | ||
"email": { | ||
"type": "string", | ||
"description": "Must be a valid email address" | ||
}, | ||
"password": { | ||
"type": "string", | ||
"description": "An alphanumeric string that can also contain special characters" | ||
} | ||
} | ||
}, | ||
"Owner": { | ||
"title": "Owner", | ||
"description": "The owner who owns auction items", | ||
"type": "object", | ||
"properties": { | ||
"firstName": { | ||
"type": "string", | ||
"description": "User's first name" | ||
}, | ||
"lastName": { | ||
"type": "string", | ||
"description": "User's last name" | ||
}, | ||
"email": { | ||
"type": "string", | ||
"description": "A valid email address" | ||
} | ||
} | ||
} | ||
} | ||
} |