Skip to content

Commit 97aab4c

Browse files
committed
feat: add optional handler property to IRegisteredApiSchema and update OpenApiRegistry to use it
1 parent cfff14b commit 97aab4c

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

adminforth/servers/express.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ class ExpressServer implements IExpressHttpServer {
465465
request_schema: schema.request,
466466
response_schema: schema.response,
467467
meta: schema.meta,
468-
handler: async () => null,
468+
handler: undefined as never,
469469
});
470470
});
471471
});

adminforth/servers/openapi.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class OpenApiRegistry implements IOpenApiRegistry {
5959
request_schema: options.request_schema,
6060
response_schema: responseSchema,
6161
meta: options.meta,
62+
handler: options.handler,
6263
};
6364
const compiledRoute: CompiledApiSchema = {
6465
...route,

adminforth/types/Back.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export interface IRegisteredApiSchema {
9898
meta?: Record<string, unknown>;
9999
request_schema?: AnySchemaObject;
100100
response_schema?: AnySchemaObject;
101+
handler?: (input: IAdminForthEndpointHandlerInput) => void | Promise<any>;
101102
}
102103

103104
export interface IAdminForthApiValidationError {

0 commit comments

Comments
 (0)