Skip to content

Commit 0575358

Browse files
committed
Fix express openapi example
1 parent a9238b0 commit 0575358

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

examples/misc/express/openapi/index.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import express from "express";
2-
import { typed } from "@notainc/typed-api-spec/express/valibot";
3-
import { asAsync } from "@notainc/typed-api-spec/express";
42
import * as v from "valibot";
53
import cors from "cors";
64
import { OpenAPIV3_1 } from "openapi-types";
@@ -20,13 +18,6 @@ const openapiBaseDoc: Omit<OpenAPIV3_1.Document, "paths"> = {
2018
};
2119

2220
const apiEndpoints = {
23-
"/openapi": {
24-
get: {
25-
responses: {
26-
200: { body: v.any(), description: "openapi json" },
27-
},
28-
},
29-
},
3021
"/pets/:petId": {
3122
get: {
3223
summary: "Find pet by ID",
@@ -60,11 +51,10 @@ const newApp = () => {
6051
const app = express();
6152
app.use(express.json());
6253
app.use(cors());
63-
const wApp = asAsync(typed(apiEndpoints, app));
64-
wApp.get("/openapi", (req, res) => {
54+
// const wApp = asAsync(typed(apiEndpoints, app));
55+
app.get("/openapi", (req, res) => {
6556
const openapi = toOpenApiDoc(openapiBaseDoc, apiEndpoints);
66-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
67-
res.status(200).json(openapi as any);
57+
res.status(200).json(openapi);
6858
});
6959
return app;
7060
};

0 commit comments

Comments
 (0)