From 5eb02e272dab7f688faea43f320daeadd92872a7 Mon Sep 17 00:00:00 2001 From: Hampus Kraft Date: Tue, 17 Feb 2026 14:29:49 +0000 Subject: [PATCH] fix(openapi): simplify nullable union schemas for codegen compat --- fluxer_docs/api-reference/openapi.json | 18 +++--------------- fluxer_docs/resources/admin.mdx | 2 +- fluxer_docs/resources/premium.mdx | 2 +- .../schema/src/domains/admin/AdminSchemas.tsx | 19 +++++++++++-------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/fluxer_docs/api-reference/openapi.json b/fluxer_docs/api-reference/openapi.json index dc972c45..87c7f70c 100644 --- a/fluxer_docs/api-reference/openapi.json +++ b/fluxer_docs/api-reference/openapi.json @@ -60544,7 +60544,7 @@ "This discovery application has already been reviewed", "Discovery application not found", "A description is required for discovery", - "", + "Discovery is not available on this instance", "Community does not meet the minimum member count for discovery", "Invalid discovery category", "This community is not listed in discovery", @@ -67238,16 +67238,10 @@ "description": "The slot index" }, "user_id": { - "oneOf": [ + "anyOf": [ { "$ref": "#/components/schemas/SnowflakeType" }, - { - "type": "string", - "enum": [ - "-1" - ] - }, { "type": "null" } @@ -67300,16 +67294,10 @@ "description": "Slot index to reserve (must be >= 1)" }, "user_id": { - "oneOf": [ + "anyOf": [ { "$ref": "#/components/schemas/SnowflakeType" }, - { - "type": "string", - "enum": [ - "-1" - ] - }, { "type": "null" } diff --git a/fluxer_docs/resources/admin.mdx b/fluxer_docs/resources/admin.mdx index ca1584eb..bf5e66e7 100644 --- a/fluxer_docs/resources/admin.mdx +++ b/fluxer_docs/resources/admin.mdx @@ -2151,7 +2151,7 @@ Type: [MessageShredStatusNotFoundResponse](#messageshredstatusnotfoundresponse) | Field | Type | Description | |-------|------|-------------| | slot_index | integer (int32) | Slot index to reserve (must be >= 1) | -| user_id | [SnowflakeType](#snowflaketype) \| enum<`-1`> \| null | User ID to reserve the slot for, or null to unreserve (special value -1 is also valid) | +| user_id | ?[SnowflakeType](#snowflaketype) | User ID to reserve the slot for, or null to unreserve (special value -1 is also valid) | diff --git a/fluxer_docs/resources/premium.mdx b/fluxer_docs/resources/premium.mdx index 0bc99340..e10992d6 100644 --- a/fluxer_docs/resources/premium.mdx +++ b/fluxer_docs/resources/premium.mdx @@ -26,7 +26,7 @@ description: 'Premium object schemas from the Fluxer API.' | Field | Type | Description | |-------|------|-------------| | slot_index | integer (int32) | The slot index | -| user_id | [SnowflakeType](#snowflaketype) \| enum<`-1`> \| null | User ID that reserved this slot, or null if unreserved (special value -1 is also valid) | +| user_id | ?[SnowflakeType](#snowflaketype) | User ID that reserved this slot, or null if unreserved (special value -1 is also valid) | diff --git a/packages/schema/src/domains/admin/AdminSchemas.tsx b/packages/schema/src/domains/admin/AdminSchemas.tsx index 35289114..0146c475 100644 --- a/packages/schema/src/domains/admin/AdminSchemas.tsx +++ b/packages/schema/src/domains/admin/AdminSchemas.tsx @@ -990,12 +990,16 @@ export const DeleteApiKeyResponse = z.object({ success: z.literal(true), }); +const SnowflakeOrSentinelType = z + .string() + .regex(/^(-1|0|[1-9][0-9]*)$/) + .describe('fluxer:SnowflakeStringType'); + export const VisionarySlotSchema = z.object({ slot_index: Int32Type.describe('The slot index'), - user_id: z - .union([SnowflakeStringType, z.literal('-1')]) - .nullable() - .describe('User ID that reserved this slot, or null if unreserved (special value -1 is also valid)'), + user_id: SnowflakeOrSentinelType.nullable().describe( + 'User ID that reserved this slot, or null if unreserved (special value -1 is also valid)', + ), }); export type VisionarySlotSchema = z.infer; @@ -1024,10 +1028,9 @@ export type ShrinkVisionarySlotsRequest = z.infer= 1)'), - user_id: z - .union([SnowflakeStringType, z.literal('-1')]) - .nullable() - .describe('User ID to reserve the slot for, or null to unreserve (special value -1 is also valid)'), + user_id: SnowflakeOrSentinelType.nullable().describe( + 'User ID to reserve the slot for, or null to unreserve (special value -1 is also valid)', + ), }); export type ReserveVisionarySlotRequest = z.infer;