File tree Expand file tree Collapse file tree 1 file changed +3
-13
lines changed
examples/misc/express/openapi Expand file tree Collapse file tree 1 file changed +3
-13
lines changed Original file line number Diff line number Diff line change 11import express from "express" ;
2- import { typed } from "@notainc/typed-api-spec/express/valibot" ;
3- import { asAsync } from "@notainc/typed-api-spec/express" ;
42import * as v from "valibot" ;
53import cors from "cors" ;
64import { OpenAPIV3_1 } from "openapi-types" ;
@@ -20,13 +18,6 @@ const openapiBaseDoc: Omit<OpenAPIV3_1.Document, "paths"> = {
2018} ;
2119
2220const 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} ;
You can’t perform that action at this time.
0 commit comments