Skip to content

Commit c537243

Browse files
authored
Update Swagger UI Docs (#50)
1 parent b2a1dc7 commit c537243

21 files changed

+49
-44
lines changed

src/@types/hackthelab.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Request } from "express";
33

44
declare module "hackthelab" {
55
/**
6-
* @swagger
76
* components:
87
* schemas:
98
* User:
@@ -229,7 +228,6 @@ declare module "hackthelab" {
229228
}
230229

231230
/**
232-
* @swagger
233231
* components:
234232
* schemas:
235233
* AllActionResponseItem:
@@ -251,7 +249,6 @@ declare module "hackthelab" {
251249
}
252250

253251
/**
254-
* @swagger
255252
* components:
256253
* schemas:
257254
* AdminCell:
@@ -317,7 +314,6 @@ declare module "hackthelab" {
317314
}
318315

319316
/**
320-
* @swagger
321317
* components:
322318
* schemas:
323319
* Award:
@@ -340,7 +336,6 @@ declare module "hackthelab" {
340336
}
341337

342338
/**
343-
* @swagger
344339
* components:
345340
* schemas:
346341
* Score:
@@ -359,7 +354,6 @@ declare module "hackthelab" {
359354
}
360355

361356
/**
362-
* @swagger
363357
* components:
364358
* schemas:
365359
* RankingResult:

src/controllers/maze-controller/getActions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export const actionsSchema = [
1414
];
1515

1616
/**
17-
* @swagger
1817
* /v1/maze/{mazeId}/actions/{userId}:
1918
* get:
2019
* tags: [Maze (ADMIN)]

src/controllers/maze-controller/getAllActions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { asyncHandler } from "utils";
44
import { rethrowOrCreateError } from "utils/create-error";
55

66
/**
7-
* @swagger
87
* /v1/maze/{mazeId}/actions:
98
* get:
109
* tags: [Maze (ADMIN)]

src/controllers/maze-controller/getMaze.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import { asyncHandler } from "utils";
66
* /v1/maze/{mazeId}:
77
* get:
88
* tags: [Maze (SANDBOX)]
9-
* summary: Returns maze information for a given maze ID. (Sandbox only)
9+
* summary: Returns a maze's information.
10+
* description: Returns a maze's cells (with type and surroundings), cheese locations, dimensions, start and exit.
11+
* <br><br>
12+
* **Note** This sandbox endpoint is for testing purposes only, not all information provided is accessible during the competition.
1013
* parameters:
1114
* - $ref: '#/components/parameters/MazeRequestPathBase'
1215
* responses:
1316
* 200:
14-
* description: Fetch successful
1517
* content:
1618
* application/json:
1719
* schema:

src/controllers/maze-controller/getMazes.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ export const mazesSchema = [query("env").optional().isEnvironment()];
1111
* /v1/mazes:
1212
* get:
1313
* tags: [Maze]
14-
* summary: Returns a list of available maze IDs.
14+
* summary: Returns a list of mazes.
15+
* description: Each maze has an ID, number of cheese count, and dimensions.
16+
* Depending on the API key used (Sandbox or Competition) the respective list of mazes will be returned.
17+
* <br><br>
18+
* **Note:** The list of competition mazes will be limited until announced.
1519
* responses:
1620
* 200:
17-
* description: Fetch successful
21+
* description: Maze list successful.
1822
* content:
1923
* application/json:
2024
* schema:
2125
* type: array
2226
* items:
2327
* $ref: '#/components/schemas/MazeResponse'
2428
* type: object
25-
* 400:
26-
* $ref: '#/components/responses/BadRequest'
2729
* 401:
2830
* $ref: '#/components/responses/Unauthorized'
2931
* 403:

src/controllers/maze-controller/maze-controller.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import putMaze, { mazeUpdateSchema } from "./putMaze";
1212
* @swagger
1313
* tags:
1414
* - name: Maze
15-
* description: Maze management
15+
* description: Maze management.
1616
* - name: Maze (SANDBOX)
17-
* description: Maze management for sandbox
17+
* description: Maze management endpoint to be used in the sandbox environment.
18+
*/
19+
/**
1820
* - name: Maze (ADMIN)
1921
* description: Maze management for administrators
2022
*/

src/controllers/maze-controller/putMaze.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { MazeRequest } from "hackthelab";
33
import { MazeService } from "services";
44

55
/**
6-
* @swagger
76
* components:
87
* schemas:
98
* MazeUpdateRequestBody:
@@ -15,7 +14,6 @@ import { MazeService } from "services";
1514
export const mazeUpdateSchema = [body("locked").isBoolean().withMessage("'locked' must be provided and a boolean type.")];
1615

1716
/**
18-
* @swagger
1917
* /v1/maze/{mazeId}:
2018
* put:
2119
* tags: [Maze (ADMIN)]

src/controllers/rat-controller/getActions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { asyncHandler, rethrowOrCreateError } from "utils";
77
* /v1/rat/{mazeId}/actions:
88
* get:
99
* tags: [Rat (SANDBOX)]
10-
* summary: Returns recorded actions and score for the rat in a maze.
10+
* summary: Returns the rats progress for a maze.
11+
* description: Returns the actions the rat has taken in the maze and the score.
1112
* parameters:
1213
* - $ref: '#/components/parameters/MazeRequestPathBase'
1314
* responses:
1415
* 200:
15-
* description: Actions successful
1616
* content:
1717
* application/json:
1818
* schema:

src/controllers/rat-controller/getSurroundings.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { asyncHandler } from "utils";
88
* get:
99
* tags: [Rat]
1010
* summary: Returns the rat's immediate surroundings for the provided maze ID.
11+
* description: Response object includes the cell type for the rat's current position (`type`)
12+
* and the cell type for each direction (`north`, `east`, `south`, `west`) from the rat's current position.
1113
* parameters:
1214
* - $ref: '#/components/parameters/MazeRequestPathBase'
1315
* responses:

src/controllers/rat-controller/postDrop.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ import { asyncHandler, rethrowOrCreateError } from "utils";
77
* /v1/rat/drop:
88
* post:
99
* tags: [Rat]
10-
* summary: Allows the rat to drop a cheese in the maze.
10+
* summary: Attempts to drop a cheese.
11+
* description: Cheese will be dropped if the rat is holding a cheese and is currently positioned at a cell of type `EXIT`, otherwise the action will fail.
12+
* After a cheese is successfully dropped, the rat will be free to grab another cheese.
13+
* <br><br>
14+
* **Note:** Cheese will not automatically be dropped when the rat exits the maze.
1115
* requestBody:
1216
* description: Drop request.
1317
* required: true
@@ -17,7 +21,6 @@ import { asyncHandler, rethrowOrCreateError } from "utils";
1721
* $ref: '#/components/schemas/MazeRequest'
1822
* responses:
1923
* 200:
20-
* description: Drop successful
2124
* content:
2225
* application/json:
2326
* schema:

0 commit comments

Comments
 (0)