feat(reports): add server-driven report flows (#3330)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-09 01:38:00 +02:00
1 parent bc17922b02
commit ece622e800
471 files changed
+56262 -35932

No files matched your search

@@ -81,6 +81,7 @@ const BUILT_IN_SCHEMAS: ReadonlyArray<readonly [string, OpenAPISchema]> = [
['ThrottledError', THROTTLED_ERROR_SCHEMA],
['APIErrorCode', APIErrorCodeSchema],
];
const ALWAYS_PUBLISHED_SCHEMAS: ReadonlyArray<string> = ['APIErrorCode'];
interface IOpenAPIGeneratorCatalog {
readonly excluded: {
readonly prefixes: ReadonlyArray<string>;
@@ -92,11 +93,12 @@ interface IOpenAPIGeneratorCatalog {
};
readonly securitySchemes: Record<string, OpenAPISecurityScheme>;
readonly builtInSchemas: ReadonlyArray<readonly [string, OpenAPISchema]>;
readonly alwaysPublishedSchemas: ReadonlyArray<string>;
}
export const OpenAPIGeneratorCatalog: IOpenAPIGeneratorCatalog = {
excluded: {
prefixes: ['/test/'],
paths: new Set<string>(['/_rpc', '/oauth2/authorize']),
paths: new Set<string>(['/_rpc', '/oauth2/authorize', '/reports/guild', '/reports/message', '/reports/user']),
},
tags: {
order: TAG_DEFINITIONS.map(({name}) => name),
@@ -104,6 +106,7 @@ export const OpenAPIGeneratorCatalog: IOpenAPIGeneratorCatalog = {
},
securitySchemes: SECURITY_SCHEMES,
builtInSchemas: BUILT_IN_SCHEMAS,
alwaysPublishedSchemas: ALWAYS_PUBLISHED_SCHEMAS,
};
export function isExcludedRoutePath(routePath: string): boolean {
if (OpenAPIGeneratorCatalog.excluded.paths.has(routePath)) {
@@ -239,7 +239,7 @@ export class OpenAPIOperationBuilder {
},
};
}
Object.assign(responses, getErrorResponses(requiresAuth));
Object.assign(responses, getErrorResponses(requiresAuth, route.errorStatusCodes));
return responses;
}
}