feat(openapi): explicit object-component registration via createNamedObject (#1183)

Signed-off-by: Hampus Kraft <[email protected]>
This commit is contained in:
Hampus authored and GitHub committed 2026-06-26 10:32:50 +02:00
1 parent 6e87f6e3d1
commit 6d537ef0db
6 files changed
+87 -33

No files matched your search

@@ -13,6 +13,7 @@ import {createBase64StringType} from '@fluxer/schema/src/primitives/FileValidato
import {
createBitflagInt32Type,
createInt32EnumType,
createNamedObject,
createNamedStringLiteralUnion,
createStringType,
Int32Type,
@@ -324,7 +325,7 @@ export const OAuth2ApplicationsMeResponse = z.union([ApplicationListResponse, Ap
export type OAuth2ApplicationsMeResponse = z.infer<typeof OAuth2ApplicationsMeResponse>;
const OAuth2AuthorizationResponse = z.object({
const OAuth2AuthorizationResponse = createNamedObject('OAuth2AuthorizationResponse', {
application: z
.object({
id: SnowflakeStringType.describe('The unique identifier of the application'),
@@ -316,6 +316,11 @@ export function createNamedStringLiteralUnion<T extends string>(
.describe(`fluxer:EnumValues:${JSON.stringify(entries)}${descPart}`);
}
export function createNamedObject<T extends z.ZodRawShape>(typeName: string, shape: T, description?: string) {
const descPart = description ? ` ${description}` : '';
return z.object(shape).describe(`fluxer:NamedObject:${typeName}${descPart}`);
}
type FlexibleStringLiteralUnionOperand<T extends string> = z.ZodLiteral<T> | z.ZodString;
type FlexibleStringLiteralUnionOperands<T extends string> = [
z.ZodLiteral<T>,