Skip to content

Commit d766775

Browse files
committed
feat: add meta field to API schema interfaces for internal metadata
1 parent b431096 commit d766775

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

adminforth/servers/express.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ class ExpressServer implements IExpressHttpServer {
458458
description: schema.description,
459459
request_schema: schema.request,
460460
response_schema: schema.response,
461+
meta: schema.meta,
461462
handler: async () => null,
462463
});
463464
});

adminforth/servers/openapi.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ class OpenApiRegistry implements IOpenApiRegistry {
5858
description: options.description,
5959
request_schema: options.request_schema,
6060
response_schema: responseSchema,
61+
meta: options.meta,
6162
};
6263
const compiledRoute: CompiledApiSchema = {
6364
...route,
@@ -131,4 +132,4 @@ class OpenApiRegistry implements IOpenApiRegistry {
131132
}
132133
}
133134

134-
export default OpenApiRegistry;
135+
export default OpenApiRegistry;

adminforth/types/Back.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export interface IAdminForthEndpointOptions {
6262
request_schema?: AnySchemaObject,
6363
response_schema?: AnySchemaObject,
6464
responce_schema?: AnySchemaObject,
65+
meta?: Record<string, unknown>,
6566
handler: (input: IAdminForthEndpointHandlerInput) => void | Promise<any>,
6667
}
6768

@@ -82,12 +83,18 @@ export interface IAdminForthExpressRouteSchema {
8283
* JSON schema or Zod schema describing the JSON response body for a custom Express route.
8384
*/
8485
response?: AdminForthExpressSchemaInput;
86+
87+
/**
88+
* Internal metadata for AdminForth integrations. This is not rendered in the OpenAPI document.
89+
*/
90+
meta?: Record<string, unknown>;
8591
}
8692

8793
export interface IRegisteredApiSchema {
8894
method: string;
8995
path: string;
9096
description?: string;
97+
meta?: Record<string, unknown>;
9198
request_schema?: AnySchemaObject;
9299
response_schema?: AnySchemaObject;
93100
}

0 commit comments

Comments
 (0)