Skip to content

Commit 8c4f4b7

Browse files
committed
Cleanup
1 parent e21b85a commit 8c4f4b7

File tree

6 files changed

+33
-17
lines changed

6 files changed

+33
-17
lines changed

src/apis/extension-store-apis.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import { z } from "zod";
33
import { contextPlugin } from "../plugins/context-plugin";
44
import { NotFoundHttpError } from "@aklinker1/zeta";
55
import { HttpStatus } from "@aklinker1/zeta";
6-
import { ExtensionStoreName } from "../enums";
6+
import { ExtensionStoreName, OpenApiTag } from "../enums";
77

8-
export const extensionStoreApis = createApp()
8+
export const extensionStoreApis = createApp({
9+
tags: [OpenApiTag.ExtensionStores],
10+
})
911
.use(contextPlugin)
1012
.get(
1113
"/api/rest/:storeName/:id/screenshots/:index",
1214
{
1315
operationId: "redirectToScreenshot",
14-
tags: ["Chrome Extensions"],
1516
description:
1617
"Redirect to a screenshot's URL from the Chrome Web Store listing",
1718
params: z.object({

src/apis/graphql-apis.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { version } from "../../package.json";
44
import { createGraphql } from "../graphql";
55
import { z } from "zod";
66
import dedent from "dedent";
7+
import { OpenApiTag } from "../enums";
78

89
const PLAYGROUND_HTML = (PLAYGROUND_HTML_TEMPLATE as any as string).replace(
910
"{{VERSION}}",
@@ -12,12 +13,13 @@ const PLAYGROUND_HTML = (PLAYGROUND_HTML_TEMPLATE as any as string).replace(
1213

1314
const graphql = createGraphql();
1415

15-
export const graphqlApis = createApp()
16+
export const graphqlApis = createApp({
17+
tags: [OpenApiTag.Graphql],
18+
})
1619
.post(
1720
"/api",
1821
{
1922
summary: "Send Query",
20-
tags: ["GraphQL"],
2123
description:
2224
"Send a query to the GraphQL API. You can play around with queries on the [GraphiQL playground](/playground).",
2325
body: z
@@ -73,7 +75,6 @@ export const graphqlApis = createApp()
7375
"/playground",
7476
{
7577
operationId: "playground",
76-
tags: ["GraphQL"],
7778
description: dedent`
7879
Open the GraphiQL playground. This is where you can interact and test out
7980
the GraphQL API. It also contains the GraphQL documentation explorer.

src/apis/system-apis.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ import { createApp } from "@aklinker1/zeta";
22
import z from "zod";
33
import { version } from "../version";
44

5-
export const systemApis = createApp()
5+
export const systemApis = createApp({
6+
tags: ["System"],
7+
})
68
.get(
79
"/",
810
{
11+
operationId: "apiDocsRedirect",
912
summary: "API Docs Redirect",
10-
tags: ["System"],
1113
description: "Redirect to the API reference when visiting the root URL.",
1214
},
1315
({ set }) => {
@@ -18,8 +20,7 @@ export const systemApis = createApp()
1820
.get(
1921
"/api/health",
2022
{
21-
summary: "Health Check",
22-
tags: ["System"],
23+
operationId: "healthCheck",
2324
description: "Used to make sure the API is up and running.",
2425
responses: z.object({
2526
status: z.literal("ok"),

src/enums.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
export enum ExtensionStoreName {
2+
ChromeWebStore = "chrome-web-store",
3+
FirefoxAddonStore = "firefox-addon-store",
4+
EdgeAddonStore = "edge-addon-store",
5+
26
/** @deprecated Use {@link ChromeWebStore} instead. */
37
ChromeExtensions = "chrome-extensions",
4-
ChromeWebStore = "chrome-web-store",
58
/** @deprecated Use {@link FirefoxAddonStore} instead. */
69
FirefoxExtensions = "firefox-extensions",
7-
FirefoxAddonStore = "firefox-addon-store",
810
/** @deprecated Use {@link EdgeAddonStore} instead. */
911
EdgeExtensions = "edge-extensions",
10-
EdgeAddonStore = "edge-addon-store",
12+
}
13+
14+
export enum OpenApiTag {
15+
System = "System",
16+
ExtensionStores = "Extension Stores",
17+
Graphql = "GraphQL",
1118
}

src/models.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import z from "zod";
2+
import { ExtensionStoreName } from "./enums";
3+
4+
export const ExtensionStoreNameSchema = z
5+
.enum(ExtensionStoreName)
6+
.meta({ ref: "ExtensionStoreName" });

src/server.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { zodSchemaAdapter } from "@aklinker1/zeta/adapters/zod-schema-adapter";
77
import { version } from "./version";
88
import dedent from "dedent";
99
import { systemApis } from "./apis/system-apis";
10+
import { OpenApiTag } from "./enums";
1011

1112
const app = createApp({
1213
schemaAdapter: zodSchemaAdapter,
@@ -35,15 +36,14 @@ const app = createApp({
3536
},
3637
tags: [
3738
{
38-
name: "GraphQL",
39+
name: OpenApiTag.Graphql,
3940
description: dedent`
4041
To play around with the GraphQL API, checkout the
4142
[GraphiQL Playground](/playground).
4243
`,
4344
},
44-
{ name: "Chrome Extensions" },
45-
{ name: "Firefox Addons" },
46-
{ name: "System" },
45+
{ name: OpenApiTag.ExtensionStores },
46+
{ name: OpenApiTag.System },
4747
],
4848
},
4949
})

0 commit comments

Comments
 (0)