File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ function normalizeExpressRuntimeSchema(schema: unknown): AnySchemaObject | undef
109109 }
110110
111111 if ( isZodSchemaLike ( schema ) ) {
112- return z . toJSONSchema ( schema as any , { target : 'openapi-3.0 ' } ) as AnySchemaObject ;
112+ return z . toJSONSchema ( schema as any , { target : 'draft-07 ' } ) as AnySchemaObject ;
113113 }
114114
115115 return schema as AnySchemaObject ;
@@ -595,22 +595,22 @@ class ExpressServer implements IExpressHttpServer {
595595 description,
596596 request_schema,
597597 response_schema,
598- responce_schema,
599598 agent,
600599 target= 'json'
601600 } = options ;
602601 if ( ! path . startsWith ( '/' ) ) {
603602 throw new Error ( `Path must start with /, got: ${ path } ` ) ;
604603 }
605604 const fullPath = `${ this . adminforth . config . baseUrl } /adminapi/v1${ path } ` ;
606- const normalizedResponseSchema = response_schema ?? responce_schema ;
607- const registeredApiSchema = ( request_schema || normalizedResponseSchema )
605+ const normalizedRequestSchema = normalizeExpressRuntimeSchema ( request_schema ) ;
606+ const normalizedResponseSchema = normalizeExpressRuntimeSchema ( response_schema ) ;
607+ const registeredApiSchema = ( normalizedRequestSchema || normalizedResponseSchema )
608608 ? this . adminforth . openApi . registerApiSchema ( {
609609 method,
610610 noAuth,
611611 path : fullPath ,
612612 description,
613- request_schema,
613+ request_schema : normalizedRequestSchema ,
614614 response_schema : normalizedResponseSchema ,
615615 agent,
616616 handler,
Original file line number Diff line number Diff line change @@ -51,14 +51,13 @@ class OpenApiRegistry implements IOpenApiRegistry {
5151 }
5252
5353 registerApiSchema ( options : IAdminForthEndpointOptions ) : IRegisteredApiSchema {
54- const responseSchema = options . response_schema ?? options . responce_schema ;
5554 const route : IRegisteredApiSchema = {
5655 method : options . method . toLowerCase ( ) ,
5756 path : options . path ,
5857 description : options . description ,
5958 agent : options . agent ,
6059 request_schema : options . request_schema ,
61- response_schema : responseSchema ,
60+ response_schema : options . response_schema ,
6261 meta : options . meta ,
6362 handler : options . handler ,
6463 } ;
Original file line number Diff line number Diff line change @@ -73,7 +73,6 @@ export interface IAdminForthEndpointOptionsBase {
7373 description ?: string ,
7474 request_schema ?: AnySchemaObject ,
7575 response_schema ?: AnySchemaObject ,
76- responce_schema ?: AnySchemaObject ,
7776 agent ?: AgentToolMeta ,
7877 meta ?: Record < string , unknown > ,
7978 target ?: 'json' | 'upload' ,
You can’t perform that action at this time.
0 commit comments