Skip to content

Commit 5999c8f

Browse files
committed
New API docs
1 parent a200ab9 commit 5999c8f

File tree

2 files changed

+28
-24
lines changed

2 files changed

+28
-24
lines changed

src/api/createSwagger.ts

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,32 @@ import { writeFile, mkdir } from "fs/promises";
44
import init from "./index.js"; // Assuming this is your Fastify app initializer
55

66
const html = `
7-
<!DOCTYPE html>
8-
<html lang="en">
9-
<head>
10-
<meta charset="utf-8" />
11-
<meta name="viewport" content="width=device-width, initial-scale=1" />
12-
<meta name="description" content="ACM @ UIUC Core API Docs" />
13-
<title>ACM @ UIUC Core API</title>
14-
<link rel="stylesheet" href="https://unpkg.com/[email protected]/swagger-ui.css" />
15-
</head>
16-
<body>
17-
<div id="swagger-ui"></div>
18-
<script src="https://unpkg.com/[email protected]/swagger-ui-bundle.js" crossorigin></script>
19-
<script>
20-
window.onload = () => {
21-
window.ui = SwaggerUIBundle({
22-
url: '/docs/openapi.json',
23-
dom_id: '#swagger-ui',
24-
});
25-
};
26-
</script>
27-
</body>
7+
<!doctype html>
8+
<html>
9+
<head>
10+
<title>ACM @ UIUC Core API Reference</title>
11+
<meta charset="utf-8" />
12+
<meta
13+
name="viewport"
14+
content="width=device-width, initial-scale=1" />
15+
</head>
16+
17+
<body>
18+
<div id="app"></div>
19+
20+
<!-- Load the Script -->
21+
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
22+
23+
<!-- Initialize the Scalar API Reference -->
24+
<script>
25+
Scalar.createApiReference('#app', {
26+
// The URL of the OpenAPI/Swagger document
27+
url: '/docs/openapi.json',
28+
// Avoid CORS issues
29+
proxyUrl: 'https://proxy.scalar.com',
30+
})
31+
</script>
32+
</body>
2833
</html>
2934
`;
3035
/**

src/common/types/generic.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import * as z from "zod/v4";
33

44
export const illinoisSemesterId = z
55
.string()
6-
.min(1)
7-
.max(4)
6+
.length(4)
87
.regex(/^(fa|sp|su|wi)\d{2}$/)
98
.meta({
109
description: "Short semester slug for a given semester.",
1110
id: "IllinoisSemesterId",
12-
examples: ["sp25", "fa24"],
11+
example: "fa24",
1312
});
1413

1514
export const illinoisNetId = z

0 commit comments

Comments
 (0)