-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Doc/api ref site
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
html { | ||
box-sizing: border-box; | ||
overflow: -moz-scrollbars-vertical; | ||
overflow-y: scroll; | ||
} | ||
|
||
*, | ||
*:before, | ||
*:after { | ||
box-sizing: inherit; | ||
} | ||
|
||
body { | ||
margin: 0; | ||
background: #fafafa; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!doctype html> | ||
<html lang="en-US"> | ||
<head> | ||
<title>Swagger UI: OAuth2 Redirect</title> | ||
</head> | ||
<body> | ||
<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).replace('?', '&'); | ||
} 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.schema.get("flow") === "authorization_code" | ||
) && !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. The 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(); | ||
} | ||
|
||
if (document.readyState !== 'loading') { | ||
run(); | ||
} else { | ||
document.addEventListener('DOMContentLoaded', function () { | ||
run(); | ||
}); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
window.onload = function() { | ||
//<editor-fold desc="Changeable Configuration Block"> | ||
|
||
// the following lines will be replaced by docker/configurator, when it runs in a docker-container | ||
window.ui = SwaggerUIBundle({ | ||
url: "swagger.yaml", | ||
dom_id: '#swagger-ui', | ||
deepLinking: true, | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
], | ||
plugins: [ | ||
SwaggerUIBundle.plugins.DownloadUrl | ||
], | ||
layout: "StandaloneLayout" | ||
}); | ||
|
||
//</editor-fold> | ||
}; |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- HTML for static distribution bundle build --> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Swagger UI</title> | ||
<link rel="stylesheet" type="text/css" href="dist/swagger-ui.css" /> | ||
<link rel="stylesheet" type="text/css" href="dist/index.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" /> | ||
</head> | ||
|
||
<body> | ||
<div id="swagger-ui"></div> | ||
<script src="dist/swagger-ui-bundle.js" charset="UTF-8"> </script> | ||
<script src="dist/swagger-ui-standalone-preset.js" charset="UTF-8"> </script> | ||
<script src="dist/swagger-initializer.js" charset="UTF-8"> </script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v5.9.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: Pandemic - Reign of Cthulhu | ||
version: 1.0.0 | ||
externalDocs: | ||
description: Discussion Docs | ||
url: https://miro.com/app/board/uXjVMO8BrcQ=/?share_link_id=645659989265 | ||
servers: | ||
- url: https://petstore3.swagger.io/api/v3 | ||
tags: | ||
- name: init | ||
- name: investigator | ||
- name: action | ||
security: | ||
- bearerAuth: [] | ||
|
||
paths: | ||
/games: | ||
post: | ||
summary: Create / initialize a new game | ||
operationId: createGame | ||
tags: | ||
- init | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/CreateGameReq" | ||
required: true | ||
responses: | ||
"200": | ||
description: Successful operation | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/CreateGameRes" | ||
|
||
/games/{gameId}/investigator/order: | ||
get: | ||
summary: Get random users order in choosing the investigator | ||
operationId: findGameInvestigatorOrder | ||
tags: | ||
- init | ||
- investigator | ||
parameters: | ||
- in: path | ||
name: gameId | ||
schema: | ||
type: string | ||
format: uuid | ||
required: true | ||
responses: | ||
"200": | ||
description: Successful operation | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/FindGameInvestigatorOrderRes" | ||
|
||
/games/{gameId}/investigator: | ||
get: | ||
summary: Get 2 investigators that are not yet chosen by users | ||
operationId: findGameInvestigator | ||
tags: | ||
- init | ||
- investigator | ||
parameters: | ||
- in: path | ||
name: gameId | ||
schema: | ||
type: string | ||
format: uuid | ||
required: true | ||
responses: | ||
"200": | ||
description: Successful operation | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/FindGameInvestigatorRes" | ||
|
||
components: | ||
schemas: | ||
CreateGameReq: | ||
type: object | ||
properties: | ||
players: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/Player" | ||
CreateGameRes: | ||
type: object | ||
properties: | ||
url: | ||
type: string | ||
FindGameInvestigatorOrderRes: | ||
type: array | ||
items: | ||
$ref: "#/components/schemas/PlayerOrder" | ||
FindGameInvestigatorRes: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
investigator: | ||
$ref: "#/components/schemas/Investigator" | ||
|
||
Player: | ||
type: object | ||
properties: | ||
id: | ||
type: string | ||
format: uuid | ||
nickname: | ||
type: string | ||
PlayerOrder: | ||
type: object | ||
properties: | ||
user_id: | ||
type: string | ||
format: uuid | ||
order: | ||
type: integer | ||
|
||
Investigator: | ||
type: string | ||
enum: | ||
- detective | ||
- doctor | ||
- driver | ||
- hunter | ||
- magician | ||
- occultist | ||
- reporter | ||
|
||
Clue: | ||
type: string | ||
enum: | ||
- arkham | ||
- dunwich | ||
- kingsport | ||
- innsmouth | ||
|
||
securitySchemes: | ||
bearerAuth: # arbitrary name for the security scheme | ||
type: http | ||
scheme: bearer | ||
bearerFormat: JWT # optional, arbitrary value for documentation purposes |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Update Swagger UI | ||
on: | ||
schedule: | ||
- cron: '0 10 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
updateSwagger: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Get Latest Swagger UI Release | ||
id: swagger-ui | ||
run: | | ||
release_tag=$(curl -sL https://api.github.com/repos/swagger-api/swagger-ui/releases/latest | jq -r ".tag_name") | ||
echo "release_tag=$release_tag" >> $GITHUB_OUTPUT | ||
current_tag=$(<swagger-ui.version) | ||
echo "current_tag=$current_tag" >> $GITHUB_OUTPUT | ||
- name: Update Swagger UI | ||
if: steps.swagger-ui.outputs.current_tag != steps.swagger-ui.outputs.release_tag | ||
env: | ||
RELEASE_TAG: ${{ steps.swagger-ui.outputs.release_tag }} | ||
SWAGGER_YAML: "swagger.yaml" | ||
run: | | ||
# Delete the dist directory and index.html | ||
rm -fr dist index.html | ||
# Download the release | ||
curl -sL -o $RELEASE_TAG https://api.github.com/repos/swagger-api/swagger-ui/tarball/$RELEASE_TAG | ||
# Extract the dist directory | ||
tar -xzf $RELEASE_TAG --strip-components=1 $(tar -tzf $RELEASE_TAG | head -1 | cut -f1 -d"/")/dist | ||
rm $RELEASE_TAG | ||
# Move index.html to the root | ||
mv dist/index.html . | ||
# Fix references in dist/swagger-initializer and index.html | ||
sed -i "s|https://petstore.swagger.io/v2/swagger.json|$SWAGGER_YAML|g" dist/swagger-initializer.js | ||
sed -i "s|href=\"./|href=\"dist/|g" index.html | ||
sed -i "s|src=\"./|src=\"dist/|g" index.html | ||
sed -i "s|href=\"index|href=\"dist/index|g" index.html | ||
# Update current release | ||
echo ${{ steps.swagger-ui.outputs.release_tag }} > swagger-ui.version | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
commit-message: Update swagger-ui to ${{ steps.swagger-ui.outputs.release_tag }} | ||
title: Update SwaggerUI to ${{ steps.swagger-ui.outputs.release_tag }} | ||
body: | | ||
Updates [swagger-ui][1] to ${{ steps.swagger-ui.outputs.release_tag }} | ||
Auto-generated by [create-pull-request][2] | ||
[1]: https://github.com/swagger-api/swagger-ui | ||
[2]: https://github.com/peter-evans/create-pull-request | ||
labels: dependencies, automated pr | ||
branch: swagger-ui-updates |