A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.
fix(openapi): restore named discriminated union branches (#2785)
Hampusb693d84d2b86
diff --git a/fluxer_api/src/api/openapi/openapi.json b/fluxer_api/src/api/openapi/openapi.jsonindex 16672b05e..8ab4b3fc0 100644--- a/fluxer_api/src/api/openapi/openapi.json+++ b/fluxer_api/src/api/openapi/openapi.json@@ -24732,71 +24732,10 @@},"LocalizedCardPreapprovalContinueResponse": {"oneOf": [- {- "type": "object",- "properties": {- "status": {- "type": "string",- "const": "pending",- "description": "The preapproval result is still being processed"- }- },- "required": ["status"],- "additionalProperties": false- },- {- "type": "object",- "properties": {- "status": {- "type": "string",- "const": "ready",- "description": "The preapproval succeeded and the paid checkout URL is ready"- },- "url": {"type": "string", "description": "The URL to redirect to"}- },- "required": ["status", "url"],- "additionalProperties": false- },- {- "type": "object",- "properties": {- "status": {- "type": "string",- "const": "rejected",- "description": "The preapproval failed and the paid checkout should not continue"- },- "reason": {- "type": "string",- "enum": [- "country_mismatch",- "missing_customer",- "missing_payment_method",- "missing_setup_intent",- "payment_method_not_card",- "unknown"- ],- "description": "The reason the preapproval was rejected"- },- "actual_country": {- "description": "The detected card issuing country when available",- "anyOf": [{"type": "string", "minLength": 2, "maxLength": 2}, {"type": "null"}]- }- },- "required": ["status", "reason"],- "additionalProperties": false- },- {- "type": "object",- "properties": {- "status": {- "type": "string",- "const": "expired",- "description": "The preapproval token has expired or is unknown"- }- },- "required": ["status"],- "additionalProperties": false- }+ {"$ref": "#/components/schemas/PendingLocalizedCardPreapprovalContinueResponse"},+ {"$ref": "#/components/schemas/ReadyLocalizedCardPreapprovalContinueResponse"},+ {"$ref": "#/components/schemas/RejectedLocalizedCardPreapprovalContinueResponse"},+ {"$ref": "#/components/schemas/ExpiredLocalizedCardPreapprovalContinueResponse"}]},"CreateCheckoutSessionRequest": {@@ -25223,378 +25162,9 @@},"DsaReportRequest": {"oneOf": [- {- "type": "object",- "properties": {- "ticket": {"description": "Verification ticket obtained from email verification", "type": "string"},- "additional_info": {"description": "Additional context or details about the report", "type": "string"},- "reporter_full_legal_name": {- "description": "Full legal name of the person filing the report",- "type": "string"- },- "reporter_country_of_residence": {- "description": "EU country code of the reporter residence",- "x-enumNames": [- "AT",- "BE",- "BG",- "HR",- "CY",- "CZ",- "DK",- "EE",- "FI",- "FR",- "DE",- "GR",- "HU",- "IE",- "IT",- "LV",- "LT",- "LU",- "MT",- "NL",- "PL",- "PT",- "RO",- "SK",- "SI",- "ES",- "SE"- ],- "x-enumDescriptions": [- "Austria",- "Belgium",- "Bulgaria",- "Croatia",- "Cyprus",- "Czechia",- "Denmark",- "Estonia",- "Finland",- "France",- "Germany",- "Greece",- "Hungary",- "Ireland",- "Italy",- "Latvia",- "Lithuania",- "Luxembourg",- "Malta",- "Netherlands",- "Poland",- "Portugal",- "Romania",- "Slovakia",- "Slovenia",- "Spain",- "Sweden"- ],- "enum": [- "AT",- "BE",- "BG",- "HR",- "CY",- "CZ",- "DK",- "EE",- "FI",- "FR",- "DE",- "GR",- "HU",- "IE",- "IT",- "LV",- "LT",- "LU",- "MT",- "NL",- "PL",- "PT",- "RO",- "SK",- "SI",- "ES",- "SE"- ],- "type": "string"- },- "reporter_fluxer_tag": {- "description": "Fluxer tag of the reporter if they have an account",- "type": "string",- "minLength": 3,- "maxLength": 37- },- "report_type": {"type": "string", "const": "message", "description": "Type of report"},- "category": {"$ref": "#/components/schemas/MessageReportCategory"},- "message_link": {"description": "Link to the message being reported", "type": "string"},- "reported_user_tag": {- "description": "Fluxer tag of the user who sent the message",- "type": "string",- "minLength": 3,- "maxLength": 37- }- },- "required": [- "ticket",- "reporter_full_legal_name",- "reporter_country_of_residence",- "report_type",- "category",- "message_link"- ]- },- {- "type": "object",- "properties": {- "ticket": {"description": "Verification ticket obtained from email verification", "type": "string"},- "additional_info": {"description": "Additional context or details about the report", "type": "string"},- "reporter_full_legal_name": {- "description": "Full legal name of the person filing the report",- "type": "string"- },- "reporter_country_of_residence": {- "description": "EU country code of the reporter residence",- "x-enumNames": [- "AT",- "BE",- "BG",- "HR",- "CY",- "CZ",- "DK",- "EE",- "FI",- "FR",- "DE",- "GR",- "HU",- "IE",- "IT",- "LV",- "LT",- "LU",- "MT",- "NL",- "PL",- "PT",- "RO",- "SK",- "SI",- "ES",- "SE"- ],- "x-enumDescriptions": [- "Austria",- "Belgium",- "Bulgaria",- "Croatia",- "Cyprus",- "Czechia",- "Denmark",- "Estonia",- "Finland",- "France",- "Germany",- "Greece",- "Hungary",- "Ireland",- "Italy",- "Latvia",- "Lithuania",- "Luxembourg",- "Malta",- "Netherlands",- "Poland",- "Portugal",- "Romania",- "Slovakia",- "Slovenia",- "Spain",- "Sweden"- ],- "enum": [- "AT",- "BE",- "BG",- "HR",- "CY",- "CZ",- "DK",- "EE",- "FI",- "FR",- "DE",- "GR",- "HU",- "IE",- "IT",- "LV",- "LT",- "LU",- "MT",- "NL",- "PL",- "PT",- "RO",- "SK",- "SI",- "ES",- "SE"- ],- "type": "string"- },- "reporter_fluxer_tag": {- "description": "Fluxer tag of the reporter if they have an account",- "type": "string",- "minLength": 3,- "maxLength": 37- },- "report_type": {"type": "string", "const": "user", "description": "Type of report"},- "category": {"$ref": "#/components/schemas/UserReportCategory"},- "user_id": {"description": "ID of the user being reported", "$ref": "#/components/schemas/SnowflakeType"},- "user_tag": {- "description": "Fluxer tag of the user being reported",- "type": "string",- "minLength": 3,- "maxLength": 37- }- },- "required": [- "ticket",- "reporter_full_legal_name",- "reporter_country_of_residence",- "report_type",- "category"- ]- },- {- "type": "object",- "properties": {- "ticket": {"description": "Verification ticket obtained from email verification", "type": "string"},- "additional_info": {"description": "Additional context or details about the report", "type": "string"},- "reporter_full_legal_name": {- "description": "Full legal name of the person filing the report",- "type": "string"- },- "reporter_country_of_residence": {- "description": "EU country code of the reporter residence",- "x-enumNames": [- "AT",- "BE",- "BG",- "HR",- "CY",- "CZ",- "DK",- "EE",- "FI",- "FR",- "DE",- "GR",- "HU",- "IE",- "IT",- "LV",- "LT",- "LU",- "MT",- "NL",- "PL",- "PT",- "RO",- "SK",- "SI",- "ES",- "SE"- ],- "x-enumDescriptions": [- "Austria",- "Belgium",- "Bulgaria",- "Croatia",- "Cyprus",- "Czechia",- "Denmark",- "Estonia",- "Finland",- "France",- "Germany",- "Greece",- "Hungary",- "Ireland",- "Italy",- "Latvia",- "Lithuania",- "Luxembourg",- "Malta",- "Netherlands",- "Poland",- "Portugal",- "Romania",- "Slovakia",- "Slovenia",- "Spain",- "Sweden"- ],- "enum": [- "AT",- "BE",- "BG",- "HR",- "CY",- "CZ",- "DK",- "EE",- "FI",- "FR",- "DE",- "GR",- "HU",- "IE",- "IT",- "LV",- "LT",- "LU",- "MT",- "NL",- "PL",- "PT",- "RO",- "SK",- "SI",- "ES",- "SE"- ],- "type": "string"- },- "reporter_fluxer_tag": {- "description": "Fluxer tag of the reporter if they have an account",- "type": "string",- "minLength": 3,- "maxLength": 37- },- "report_type": {"type": "string", "const": "guild", "description": "Type of report"},- "category": {"$ref": "#/components/schemas/GuildReportCategory"},- "guild_id": {- "description": "ID of the guild being reported",- "$ref": "#/components/schemas/SnowflakeType"- },- "invite_code": {"description": "Invite code used to access the guild", "type": "string"}- },- "required": [- "ticket",- "reporter_full_legal_name",- "reporter_country_of_residence",- "report_type",- "category",- "guild_id"- ]- }+ {"$ref": "#/components/schemas/MessageDsaReportRequest"},+ {"$ref": "#/components/schemas/UserDsaReportRequest"},+ {"$ref": "#/components/schemas/GuildDsaReportRequest"}]},"ReadStateAckBulkRequest": {@@ -25665,96 +25235,9 @@},"SwitchToListPriceResponse": {"oneOf": [- {- "type": "object",- "properties": {- "effective_at": {"type": "string", "description": "ISO timestamp the switch takes effect"},- "target_price_id": {- "type": "string",- "description": "Stripe price ID the subscription will be billed against after the switch"- },- "target_amount_minor": {- "type": "integer",- "minimum": -9007199254740991,- "maximum": 9007199254740991,- "description": "Amount billed after the switch, in the currency minor unit"- },- "current_amount_minor": {- "type": "integer",- "minimum": -9007199254740991,- "maximum": 9007199254740991,- "description": "Amount billed before the switch, in the currency minor unit"- },- "currency": {"description": "Currency of both amounts", "$ref": "#/components/schemas/PremiumCurrency"},- "status": {- "type": "string",- "const": "scheduled",- "description": "The switch was scheduled for the end of the current billing period"- }- },- "required": [- "effective_at",- "target_price_id",- "target_amount_minor",- "current_amount_minor",- "currency",- "status"- ],- "additionalProperties": false- },- {- "type": "object",- "properties": {- "effective_at": {"type": "string", "description": "ISO timestamp the switch takes effect"},- "target_price_id": {- "type": "string",- "description": "Stripe price ID the subscription will be billed against after the switch"- },- "target_amount_minor": {- "type": "integer",- "minimum": -9007199254740991,- "maximum": 9007199254740991,- "description": "Amount billed after the switch, in the currency minor unit"- },- "current_amount_minor": {- "type": "integer",- "minimum": -9007199254740991,- "maximum": 9007199254740991,- "description": "Amount billed before the switch, in the currency minor unit"- },- "currency": {"description": "Currency of both amounts", "$ref": "#/components/schemas/PremiumCurrency"},- "status": {- "type": "string",- "const": "already_scheduled",- "description": "The switch was already scheduled by an earlier request"- }- },- "required": [- "effective_at",- "target_price_id",- "target_amount_minor",- "current_amount_minor",- "currency",- "status"- ],- "additionalProperties": false- },- {- "type": "object",- "properties": {- "status": {- "type": "string",- "const": "ineligible",- "description": "The subscription cannot be moved to the current list price"- },- "reason": {- "description": "Why the switch was refused",- "$ref": "#/components/schemas/ListPriceSwitchIneligibilityReason"- }- },- "required": ["status", "reason"],- "additionalProperties": false- }+ {"$ref": "#/components/schemas/ScheduledSwitchToListPriceResponse"},+ {"$ref": "#/components/schemas/AlreadyScheduledSwitchToListPriceResponse"},+ {"$ref": "#/components/schemas/IneligibleSwitchToListPriceResponse"}]},"PremiumStateResponse": {@@ -26178,39 +25661,8 @@},"TokenRequest": {"oneOf": [- {- "type": "object",- "properties": {- "grant_type": {- "type": "string",- "const": "authorization_code",- "description": "The grant type for exchanging an authorization code"- },- "code": {"description": "The authorization code received from the authorize endpoint", "type": "string"},- "redirect_uri": {"description": "The redirect URI used in the authorization request", "type": "string"},- "client_id": {"description": "The application client ID", "$ref": "#/components/schemas/SnowflakeType"},- "client_secret": {"description": "The application client secret", "type": "string"},- "code_verifier": {"description": "The PKCE code verifier for the authorization request", "type": "string"}- },- "required": ["grant_type", "code", "redirect_uri"]- },- {- "type": "object",- "properties": {- "grant_type": {- "type": "string",- "const": "refresh_token",- "description": "The grant type for refreshing an access token"- },- "refresh_token": {- "description": "The refresh token to exchange for a new access token",- "type": "string"- },- "client_id": {"description": "The application client ID", "$ref": "#/components/schemas/SnowflakeType"},- "client_secret": {"description": "The application client secret", "type": "string"}- },- "required": ["grant_type", "refresh_token"]- }+ {"$ref": "#/components/schemas/AuthorizationCodeTokenRequest"},+ {"$ref": "#/components/schemas/RefreshTokenTokenRequest"}]},"OAuth2TokenResponse": {@@ -27656,333 +27108,21 @@},"ChannelCreateRequest": {"oneOf": [- {- "type": "object",- "properties": {- "topic": {- "description": "The channel topic (1-1024 characters)",- "anyOf": [{"type": "string"}, {"type": "null"}]- },- "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},- "parent_id": {- "description": "ID of the parent category for this channel",- "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]- },- "bitrate": {- "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",- "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]- },- "user_limit": {- "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]- },- "voice_connection_limit": {- "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",- "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]- },- "permission_overwrites": {- "description": "Permission overwrites for roles and members",- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "description": "The ID of the role or user to overwrite permissions for",- "$ref": "#/components/schemas/SnowflakeType"- },- "type": {- "description": "The type of overwrite (0 = role, 1 = member)",- "x-enumNames": ["ROLE", "MEMBER"],- "enum": [0, 1],- "type": "integer"- },- "allow": {- "description": "Bitwise value of allowed permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- },- "deny": {- "description": "Bitwise value of denied permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- }- },- "required": ["id", "type"]- }- },- "rate_limit_per_user": {- "description": "Slowmode delay in seconds (0-21600)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]- },- "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},- "nsfw_override": {- "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",- "anyOf": [{"type": "boolean"}, {"type": "null"}]- },- "content_warning_level": {- "description": "Channel-level content warning override (0=inherit, 1=force-warn)",- "$ref": "#/components/schemas/ContentWarningLevelInput"- },- "content_warning_text": {- "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",- "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]- },- "type": {- "type": "integer",- "x-enumNames": ["GUILD_TEXT"],- "x-enumDescriptions": ["Channel type (text channel)"],- "enum": [0]- },- "name": {"description": "The name of the channel", "type": "string"}- },- "required": ["type", "name"]- },- {- "type": "object",- "properties": {- "topic": {- "description": "The channel topic (1-1024 characters)",- "anyOf": [{"type": "string"}, {"type": "null"}]- },- "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},- "parent_id": {- "description": "ID of the parent category for this channel",- "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]- },- "bitrate": {- "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",- "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]- },- "user_limit": {- "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]- },- "voice_connection_limit": {- "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",- "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]- },- "permission_overwrites": {- "description": "Permission overwrites for roles and members",- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "description": "The ID of the role or user to overwrite permissions for",- "$ref": "#/components/schemas/SnowflakeType"- },- "type": {- "description": "The type of overwrite (0 = role, 1 = member)",- "x-enumNames": ["ROLE", "MEMBER"],- "enum": [0, 1],- "type": "integer"- },- "allow": {- "description": "Bitwise value of allowed permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- },- "deny": {- "description": "Bitwise value of denied permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- }- },- "required": ["id", "type"]- }- },- "rate_limit_per_user": {- "description": "Slowmode delay in seconds (0-21600)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]- },- "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},- "nsfw_override": {- "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",- "anyOf": [{"type": "boolean"}, {"type": "null"}]- },- "content_warning_level": {- "description": "Channel-level content warning override (0=inherit, 1=force-warn)",- "$ref": "#/components/schemas/ContentWarningLevelInput"- },- "content_warning_text": {- "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",- "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]- },- "type": {- "type": "integer",- "x-enumNames": ["GUILD_VOICE"],- "x-enumDescriptions": ["Channel type (voice channel)"],- "enum": [2]- },- "name": {"description": "The name of the channel", "type": "string"}- },- "required": ["type", "name"]- },- {- "type": "object",- "properties": {- "topic": {- "description": "The channel topic (1-1024 characters)",- "anyOf": [{"type": "string"}, {"type": "null"}]- },- "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},- "parent_id": {- "description": "ID of the parent category for this channel",- "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]- },- "bitrate": {- "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",- "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]- },- "user_limit": {- "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]- },- "voice_connection_limit": {- "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",- "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]- },- "permission_overwrites": {- "description": "Permission overwrites for roles and members",- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "description": "The ID of the role or user to overwrite permissions for",- "$ref": "#/components/schemas/SnowflakeType"- },- "type": {- "description": "The type of overwrite (0 = role, 1 = member)",- "x-enumNames": ["ROLE", "MEMBER"],- "enum": [0, 1],- "type": "integer"- },- "allow": {- "description": "Bitwise value of allowed permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- },- "deny": {- "description": "Bitwise value of denied permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- }- },- "required": ["id", "type"]- }- },- "rate_limit_per_user": {- "description": "Slowmode delay in seconds (0-21600)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]- },- "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},- "nsfw_override": {- "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",- "anyOf": [{"type": "boolean"}, {"type": "null"}]- },- "content_warning_level": {- "description": "Channel-level content warning override (0=inherit, 1=force-warn)",- "$ref": "#/components/schemas/ContentWarningLevelInput"- },- "content_warning_text": {- "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",- "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]- },- "type": {- "type": "integer",- "x-enumNames": ["GUILD_CATEGORY"],- "x-enumDescriptions": ["Channel type (category)"],- "enum": [4]- },- "name": {"description": "The name of the category", "type": "string"}- },- "required": ["type", "name"]- },- {- "type": "object",- "properties": {- "topic": {- "description": "The channel topic (1-1024 characters)",- "anyOf": [{"type": "string"}, {"type": "null"}]- },- "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},- "parent_id": {- "description": "ID of the parent category for this channel",- "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]- },- "bitrate": {- "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",- "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]- },- "user_limit": {- "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]- },- "voice_connection_limit": {- "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",- "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]- },- "permission_overwrites": {- "description": "Permission overwrites for roles and members",- "type": "array",- "items": {- "type": "object",- "properties": {- "id": {- "description": "The ID of the role or user to overwrite permissions for",- "$ref": "#/components/schemas/SnowflakeType"- },- "type": {- "description": "The type of overwrite (0 = role, 1 = member)",- "x-enumNames": ["ROLE", "MEMBER"],- "enum": [0, 1],- "type": "integer"- },- "allow": {- "description": "Bitwise value of allowed permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- },- "deny": {- "description": "Bitwise value of denied permissions",- "$ref": "#/components/schemas/UnsignedInt64Type"- }- },- "required": ["id", "type"]- }- },- "rate_limit_per_user": {- "description": "Slowmode delay in seconds (0-21600)",- "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]- },- "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},- "nsfw_override": {- "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",- "anyOf": [{"type": "boolean"}, {"type": "null"}]- },- "content_warning_level": {- "description": "Channel-level content warning override (0=inherit, 1=force-warn)",- "$ref": "#/components/schemas/ContentWarningLevelInput"- },- "content_warning_text": {- "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",- "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]- },- "type": {- "type": "integer",- "x-enumNames": ["GUILD_LINK"],- "x-enumDescriptions": ["Channel type (link channel)"],- "enum": [998]- },- "name": {"description": "The name of the channel", "type": "string"}- },- "required": ["type", "name"]- }- ]- },- "GuildBanCreateRequest": {- "type": "object",- "properties": {- "delete_message_days": {- "default": 0,- "description": "Number of days of messages to delete from the banned user (0-7). Deprecated in favor of delete_message_seconds.",- "type": "integer",- "minimum": 0,- "maximum": 7+ {"$ref": "#/components/schemas/GuildTextChannelCreateRequest"},+ {"$ref": "#/components/schemas/GuildVoiceChannelCreateRequest"},+ {"$ref": "#/components/schemas/GuildCategoryChannelCreateRequest"},+ {"$ref": "#/components/schemas/GuildLinkChannelCreateRequest"}+ ]+ },+ "GuildBanCreateRequest": {+ "type": "object",+ "properties": {+ "delete_message_days": {+ "default": 0,+ "description": "Number of days of messages to delete from the banned user (0-7). Deprecated in favor of delete_message_seconds.",+ "type": "integer",+ "minimum": 0,+ "maximum": 7},"delete_message_seconds": {"description": "Number of seconds of messages to delete for the banned user (0-604800, default 0)",@@ -30516,114 +29656,116 @@},"PresignedAttachmentUploadResponseItem": {"oneOf": [- {- "type": "object",- "properties": {- "id": {- "description": "The client-side identifier for this attachment",- "$ref": "#/components/schemas/Int32Type"- },- "filename": {"description": "The original filename for this upload", "type": "string"},- "file_size": {- "description": "Expected file size in bytes",- "$ref": "#/components/schemas/NonNegativeSafeIntegerType"- },- "content_type": {- "description": "Expected MIME type for this upload",- "type": "string",- "minLength": 1,- "maxLength": 255- },- "upload_filename": {- "description": "Temporary upload key to reference in message send payloads",- "type": "string",- "minLength": 1,- "maxLength": 4096- },- "upload_mode": {"type": "string", "const": "singlepart"},- "upload_url": {- "description": "Presigned URL used to upload this attachment with a single PUT",- "type": "string",- "minLength": 1,- "maxLength": 2048- }- },- "required": ["id", "filename", "file_size", "content_type", "upload_filename", "upload_mode", "upload_url"],- "additionalProperties": false+ {"$ref": "#/components/schemas/SinglepartPresignedAttachmentUploadResponseItem"},+ {"$ref": "#/components/schemas/MultipartPresignedAttachmentUploadResponseItem"}+ ]+ },+ "MultipartPresignedAttachmentUploadResponseItem": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The client-side identifier for this attachment",+ "$ref": "#/components/schemas/Int32Type"},- {- "type": "object",- "properties": {- "id": {- "description": "The client-side identifier for this attachment",- "$ref": "#/components/schemas/Int32Type"- },- "filename": {"description": "The original filename for this upload", "type": "string"},- "file_size": {- "description": "Expected file size in bytes",- "$ref": "#/components/schemas/NonNegativeSafeIntegerType"- },- "content_type": {- "description": "Expected MIME type for this upload",- "type": "string",- "minLength": 1,- "maxLength": 255- },- "upload_filename": {- "description": "Temporary upload key to reference in message send payloads",- "type": "string",- "minLength": 1,- "maxLength": 4096- },- "upload_mode": {"type": "string", "const": "multipart"},- "upload_id": {- "description": "S3 multipart upload identifier; required to complete the upload",- "type": "string",- "minLength": 1,- "maxLength": 1024- },- "part_size": {- "description": "Size in bytes of each part except the last",- "$ref": "#/components/schemas/NonNegativeSafeIntegerType"- },- "parts": {- "minItems": 1,- "maxItems": 10000,- "type": "array",- "items": {- "type": "object",- "properties": {- "part_number": {- "description": "1-indexed part number; order is required for completion",- "$ref": "#/components/schemas/Int32Type"- },- "upload_url": {- "description": "Presigned URL used to upload this part",- "type": "string",- "minLength": 1,- "maxLength": 2048- }- },- "required": ["part_number", "upload_url"],- "additionalProperties": false+ "filename": {"description": "The original filename for this upload", "type": "string"},+ "file_size": {+ "description": "Expected file size in bytes",+ "$ref": "#/components/schemas/NonNegativeSafeIntegerType"+ },+ "content_type": {+ "description": "Expected MIME type for this upload",+ "type": "string",+ "minLength": 1,+ "maxLength": 255+ },+ "upload_filename": {+ "description": "Temporary upload key to reference in message send payloads",+ "type": "string",+ "minLength": 1,+ "maxLength": 4096+ },+ "upload_mode": {"type": "string", "const": "multipart"},+ "upload_id": {+ "description": "S3 multipart upload identifier; required to complete the upload",+ "type": "string",+ "minLength": 1,+ "maxLength": 1024+ },+ "part_size": {+ "description": "Size in bytes of each part except the last",+ "$ref": "#/components/schemas/NonNegativeSafeIntegerType"+ },+ "parts": {+ "minItems": 1,+ "maxItems": 10000,+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "part_number": {+ "description": "1-indexed part number; order is required for completion",+ "$ref": "#/components/schemas/Int32Type"},- "description": "Per-part presigned URLs for parallel upload"- }+ "upload_url": {+ "description": "Presigned URL used to upload this part",+ "type": "string",+ "minLength": 1,+ "maxLength": 2048+ }+ },+ "required": ["part_number", "upload_url"],+ "additionalProperties": false},- "required": [- "id",- "filename",- "file_size",- "content_type",- "upload_filename",- "upload_mode",- "upload_id",- "part_size",- "parts"- ],- "additionalProperties": false+ "description": "Per-part presigned URLs for parallel upload"}- ]+ },+ "required": [+ "id",+ "filename",+ "file_size",+ "content_type",+ "upload_filename",+ "upload_mode",+ "upload_id",+ "part_size",+ "parts"+ ],+ "additionalProperties": false+ },+ "SinglepartPresignedAttachmentUploadResponseItem": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The client-side identifier for this attachment",+ "$ref": "#/components/schemas/Int32Type"+ },+ "filename": {"description": "The original filename for this upload", "type": "string"},+ "file_size": {+ "description": "Expected file size in bytes",+ "$ref": "#/components/schemas/NonNegativeSafeIntegerType"+ },+ "content_type": {+ "description": "Expected MIME type for this upload",+ "type": "string",+ "minLength": 1,+ "maxLength": 255+ },+ "upload_filename": {+ "description": "Temporary upload key to reference in message send payloads",+ "type": "string",+ "minLength": 1,+ "maxLength": 4096+ },+ "upload_mode": {"type": "string", "const": "singlepart"},+ "upload_url": {+ "description": "Presigned URL used to upload this attachment with a single PUT",+ "type": "string",+ "minLength": 1,+ "maxLength": 2048+ }+ },+ "required": ["id", "filename", "file_size", "content_type", "upload_filename", "upload_mode", "upload_url"],+ "additionalProperties": false},"NonNegativeSafeIntegerType": {"type": "integer", "minimum": 0, "maximum": 9007199254740991},"PresignedAttachmentUploadRequestItem": {@@ -32662,100 +31804,416 @@"required": ["user", "moderator_id", "banned_at"],"additionalProperties": false},- "NSFWLevel": {- "description": "The NSFW level of the guild",- "type": "integer",- "enum": [0, 3],- "format": "int32",- "x-enumNames": ["SAFE", "AGE_RESTRICTED"],- "x-enumDescriptions": ["Guild is safe for all ages", "Guild is age-restricted"]- },- "GuildEmojiWithUserResponse": {+ "GuildLinkChannelCreateRequest": {"type": "object","properties": {- "id": {- "description": "The unique identifier for this emoji",- "$ref": "#/components/schemas/SnowflakeStringType"+ "topic": {+ "description": "The channel topic (1-1024 characters)",+ "anyOf": [{"type": "string"}, {"type": "null"}]},- "name": {"type": "string", "description": "The name of the emoji"},- "animated": {"type": "boolean", "description": "Whether this emoji is animated"},- "nsfw": {- "type": "boolean",- "description": "Deprecated; always false. Retained for compatibility with older clients"+ "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},+ "parent_id": {+ "description": "ID of the parent category for this channel",+ "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]},- "user": {- "description": "The user who uploaded this emoji",- "$ref": "#/components/schemas/UserPartialResponse"- }+ "bitrate": {+ "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",+ "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]+ },+ "user_limit": {+ "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]+ },+ "voice_connection_limit": {+ "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",+ "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]+ },+ "permission_overwrites": {+ "description": "Permission overwrites for roles and members",+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The ID of the role or user to overwrite permissions for",+ "$ref": "#/components/schemas/SnowflakeType"+ },+ "type": {+ "description": "The type of overwrite (0 = role, 1 = member)",+ "x-enumNames": ["ROLE", "MEMBER"],+ "enum": [0, 1],+ "type": "integer"+ },+ "allow": {+ "description": "Bitwise value of allowed permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ },+ "deny": {+ "description": "Bitwise value of denied permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ }+ },+ "required": ["id", "type"]+ }+ },+ "rate_limit_per_user": {+ "description": "Slowmode delay in seconds (0-21600)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]+ },+ "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},+ "nsfw_override": {+ "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",+ "anyOf": [{"type": "boolean"}, {"type": "null"}]+ },+ "content_warning_level": {+ "description": "Channel-level content warning override (0=inherit, 1=force-warn)",+ "$ref": "#/components/schemas/ContentWarningLevelInput"+ },+ "content_warning_text": {+ "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",+ "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]+ },+ "type": {+ "type": "integer",+ "x-enumNames": ["GUILD_LINK"],+ "x-enumDescriptions": ["Channel type (link channel)"],+ "enum": [998]+ },+ "name": {"description": "The name of the channel", "type": "string"}},- "required": ["id", "name", "animated", "nsfw", "user"],- "additionalProperties": false+ "required": ["type", "name"]},- "GuildMemberSearchResult": {+ "GuildCategoryChannelCreateRequest": {"type": "object","properties": {- "id": {"type": "string", "description": "Composite ID (guildId:userId)"},- "guild_id": {"type": "string", "description": "Guild ID"},- "user_id": {"type": "string", "description": "User ID"},- "username": {"type": "string", "description": "Username"},- "discriminator": {"type": "string", "description": "Zero-padded 4-digit discriminator"},- "global_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Global display name"},- "nickname": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Guild nickname"},- "role_ids": {"type": "array", "items": {"type": "string"}, "description": "Role IDs"},- "joined_at": {"type": "number", "description": "Unix timestamp of when the member joined"},- "supplemental": {- "type": "object",- "properties": {- "join_source_type": {- "description": "How the member joined",- "anyOf": [{"$ref": "#/components/schemas/JoinSourceType"}, {"type": "null"}]- },- "source_invite_code": {- "anyOf": [{"type": "string"}, {"type": "null"}],- "description": "Invite code used to join"+ "topic": {+ "description": "The channel topic (1-1024 characters)",+ "anyOf": [{"type": "string"}, {"type": "null"}]+ },+ "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},+ "parent_id": {+ "description": "ID of the parent category for this channel",+ "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]+ },+ "bitrate": {+ "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",+ "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]+ },+ "user_limit": {+ "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]+ },+ "voice_connection_limit": {+ "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",+ "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]+ },+ "permission_overwrites": {+ "description": "Permission overwrites for roles and members",+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The ID of the role or user to overwrite permissions for",+ "$ref": "#/components/schemas/SnowflakeType"+ },+ "type": {+ "description": "The type of overwrite (0 = role, 1 = member)",+ "x-enumNames": ["ROLE", "MEMBER"],+ "enum": [0, 1],+ "type": "integer"+ },+ "allow": {+ "description": "Bitwise value of allowed permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ },+ "deny": {+ "description": "Bitwise value of denied permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ }},- "inviter_id": {- "anyOf": [{"type": "string"}, {"type": "null"}],- "description": "User ID of the member who sent the invite"- }- },- "required": ["source_invite_code", "inviter_id"],- "additionalProperties": false,- "description": "Supplemental members-search-only metadata that is not part of the base guild member payload"+ "required": ["id", "type"]+ }},- "is_bot": {"type": "boolean", "description": "Whether the user is a bot"}+ "rate_limit_per_user": {+ "description": "Slowmode delay in seconds (0-21600)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]+ },+ "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},+ "nsfw_override": {+ "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",+ "anyOf": [{"type": "boolean"}, {"type": "null"}]+ },+ "content_warning_level": {+ "description": "Channel-level content warning override (0=inherit, 1=force-warn)",+ "$ref": "#/components/schemas/ContentWarningLevelInput"+ },+ "content_warning_text": {+ "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",+ "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]+ },+ "type": {+ "type": "integer",+ "x-enumNames": ["GUILD_CATEGORY"],+ "x-enumDescriptions": ["Channel type (category)"],+ "enum": [4]+ },+ "name": {"description": "The name of the category", "type": "string"}},- "required": [- "id",- "guild_id",- "user_id",- "username",- "discriminator",- "global_name",- "nickname",- "role_ids",- "joined_at",- "supplemental",- "is_bot"- ],- "additionalProperties": false+ "required": ["type", "name"]},- "JoinSourceType": {- "description": "How the member joined the guild",- "type": "integer",- "enum": [0, 1, 2, 3, 4, 6],- "format": "int32",- "x-enumNames": ["CREATOR", "INSTANT_INVITE", "VANITY_URL", "BOT_INVITE", "ADMIN_FORCE_ADD", "DISCOVERY"],- "x-enumDescriptions": [- "Member created the guild",- "Member joined via an instant invite",- "Member joined via the vanity URL",- "Member was added via a bot invite",- "Member was force-added by a platform administrator",- "Member joined via guild discovery"- ]- },- "JoinSourceTypeInput": {+ "GuildVoiceChannelCreateRequest": {+ "type": "object",+ "properties": {+ "topic": {+ "description": "The channel topic (1-1024 characters)",+ "anyOf": [{"type": "string"}, {"type": "null"}]+ },+ "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},+ "parent_id": {+ "description": "ID of the parent category for this channel",+ "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]+ },+ "bitrate": {+ "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",+ "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]+ },+ "user_limit": {+ "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]+ },+ "voice_connection_limit": {+ "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",+ "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]+ },+ "permission_overwrites": {+ "description": "Permission overwrites for roles and members",+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The ID of the role or user to overwrite permissions for",+ "$ref": "#/components/schemas/SnowflakeType"+ },+ "type": {+ "description": "The type of overwrite (0 = role, 1 = member)",+ "x-enumNames": ["ROLE", "MEMBER"],+ "enum": [0, 1],+ "type": "integer"+ },+ "allow": {+ "description": "Bitwise value of allowed permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ },+ "deny": {+ "description": "Bitwise value of denied permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ }+ },+ "required": ["id", "type"]+ }+ },+ "rate_limit_per_user": {+ "description": "Slowmode delay in seconds (0-21600)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]+ },+ "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},+ "nsfw_override": {+ "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",+ "anyOf": [{"type": "boolean"}, {"type": "null"}]+ },+ "content_warning_level": {+ "description": "Channel-level content warning override (0=inherit, 1=force-warn)",+ "$ref": "#/components/schemas/ContentWarningLevelInput"+ },+ "content_warning_text": {+ "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",+ "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]+ },+ "type": {+ "type": "integer",+ "x-enumNames": ["GUILD_VOICE"],+ "x-enumDescriptions": ["Channel type (voice channel)"],+ "enum": [2]+ },+ "name": {"description": "The name of the channel", "type": "string"}+ },+ "required": ["type", "name"]+ },+ "GuildTextChannelCreateRequest": {+ "type": "object",+ "properties": {+ "topic": {+ "description": "The channel topic (1-1024 characters)",+ "anyOf": [{"type": "string"}, {"type": "null"}]+ },+ "url": {"description": "External URL for link channels", "anyOf": [{"type": "string"}, {"type": "null"}]},+ "parent_id": {+ "description": "ID of the parent category for this channel",+ "anyOf": [{"$ref": "#/components/schemas/SnowflakeType"}, {"type": "null"}]+ },+ "bitrate": {+ "description": "Voice channel bitrate in bits per second (8000-384000), clamped to 96000 unless the guild holds an AUDIO_BITRATE feature",+ "anyOf": [{"type": "integer", "minimum": 8000, "maximum": 384000}, {"type": "null"}]+ },+ "user_limit": {+ "description": "Maximum users allowed in voice channel (0-99, 0 means unlimited)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 99}, {"type": "null"}]+ },+ "voice_connection_limit": {+ "description": "Maximum active voice connections allowed per user in a voice channel (1-100)",+ "anyOf": [{"type": "integer", "minimum": 1, "maximum": 100}, {"type": "null"}]+ },+ "permission_overwrites": {+ "description": "Permission overwrites for roles and members",+ "type": "array",+ "items": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The ID of the role or user to overwrite permissions for",+ "$ref": "#/components/schemas/SnowflakeType"+ },+ "type": {+ "description": "The type of overwrite (0 = role, 1 = member)",+ "x-enumNames": ["ROLE", "MEMBER"],+ "enum": [0, 1],+ "type": "integer"+ },+ "allow": {+ "description": "Bitwise value of allowed permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ },+ "deny": {+ "description": "Bitwise value of denied permissions",+ "$ref": "#/components/schemas/UnsignedInt64Type"+ }+ },+ "required": ["id", "type"]+ }+ },+ "rate_limit_per_user": {+ "description": "Slowmode delay in seconds (0-21600)",+ "anyOf": [{"type": "integer", "minimum": 0, "maximum": 21600}, {"type": "null"}]+ },+ "nsfw": {"default": false, "description": "Whether the channel is marked as NSFW", "type": "boolean"},+ "nsfw_override": {+ "description": "Per-channel adult-content override (true=on, false=off, null=inherit from category then guild). Takes precedence over the legacy `nsfw` field if both are present.",+ "anyOf": [{"type": "boolean"}, {"type": "null"}]+ },+ "content_warning_level": {+ "description": "Channel-level content warning override (0=inherit, 1=force-warn)",+ "$ref": "#/components/schemas/ContentWarningLevelInput"+ },+ "content_warning_text": {+ "description": "Custom channel content warning text (max 200 characters); null inherits from parent or guild",+ "anyOf": [{"type": "string", "maxLength": 200}, {"type": "null"}]+ },+ "type": {+ "type": "integer",+ "x-enumNames": ["GUILD_TEXT"],+ "x-enumDescriptions": ["Channel type (text channel)"],+ "enum": [0]+ },+ "name": {"description": "The name of the channel", "type": "string"}+ },+ "required": ["type", "name"]+ },+ "NSFWLevel": {+ "description": "The NSFW level of the guild",+ "type": "integer",+ "enum": [0, 3],+ "format": "int32",+ "x-enumNames": ["SAFE", "AGE_RESTRICTED"],+ "x-enumDescriptions": ["Guild is safe for all ages", "Guild is age-restricted"]+ },+ "GuildEmojiWithUserResponse": {+ "type": "object",+ "properties": {+ "id": {+ "description": "The unique identifier for this emoji",+ "$ref": "#/components/schemas/SnowflakeStringType"+ },+ "name": {"type": "string", "description": "The name of the emoji"},+ "animated": {"type": "boolean", "description": "Whether this emoji is animated"},+ "nsfw": {+ "type": "boolean",+ "description": "Deprecated; always false. Retained for compatibility with older clients"+ },+ "user": {+ "description": "The user who uploaded this emoji",+ "$ref": "#/components/schemas/UserPartialResponse"+ }+ },+ "required": ["id", "name", "animated", "nsfw", "user"],+ "additionalProperties": false+ },+ "GuildMemberSearchResult": {+ "type": "object",+ "properties": {+ "id": {"type": "string", "description": "Composite ID (guildId:userId)"},+ "guild_id": {"type": "string", "description": "Guild ID"},+ "user_id": {"type": "string", "description": "User ID"},+ "username": {"type": "string", "description": "Username"},+ "discriminator": {"type": "string", "description": "Zero-padded 4-digit discriminator"},+ "global_name": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Global display name"},+ "nickname": {"anyOf": [{"type": "string"}, {"type": "null"}], "description": "Guild nickname"},+ "role_ids": {"type": "array", "items": {"type": "string"}, "description": "Role IDs"},+ "joined_at": {"type": "number", "description": "Unix timestamp of when the member joined"},+ "supplemental": {+ "type": "object",+ "properties": {+ "join_source_type": {+ "description": "How the member joined",+ "anyOf": [{"$ref": "#/components/schemas/JoinSourceType"}, {"type": "null"}]+ },+ "source_invite_code": {+ "anyOf": [{"type": "string"}, {"type": "null"}],+ "description": "Invite code used to join"+ },+ "inviter_id": {+ "anyOf": [{"type": "string"}, {"type": "null"}],+ "description": "User ID of the member who sent the invite"+ }+ },+ "required": ["source_invite_code", "inviter_id"],+ "additionalProperties": false,+ "description": "Supplemental members-search-only metadata that is not part of the base guild member payload"+ },+ "is_bot": {"type": "boolean", "description": "Whether the user is a bot"}+ },+ "required": [+ "id",+ "guild_id",+ "user_id",+ "username",+ "discriminator",+ "global_name",+ "nickname",+ "role_ids",+ "joined_at",+ "supplemental",+ "is_bot"+ ],+ "additionalProperties": false+ },+ "JoinSourceType": {+ "description": "How the member joined the guild",+ "type": "integer",+ "enum": [0, 1, 2, 3, 4, 6],+ "format": "int32",+ "x-enumNames": ["CREATOR", "INSTANT_INVITE", "VANITY_URL", "BOT_INVITE", "ADMIN_FORCE_ADD", "DISCOVERY"],+ "x-enumDescriptions": [+ "Member created the guild",+ "Member joined via an instant invite",+ "Member joined via the vanity URL",+ "Member was added via a bot invite",+ "Member was force-added by a platform administrator",+ "Member joined via guild discovery"+ ]+ },+ "JoinSourceTypeInput": {"description": "How the member joined the guild","type": "integer","minimum": 0,@@ -33091,6 +32549,36 @@"additionalProperties": false,"description": ""},+ "RefreshTokenTokenRequest": {+ "type": "object",+ "properties": {+ "grant_type": {+ "type": "string",+ "const": "refresh_token",+ "description": "The grant type for refreshing an access token"+ },+ "refresh_token": {"description": "The refresh token to exchange for a new access token", "type": "string"},+ "client_id": {"description": "The application client ID", "$ref": "#/components/schemas/SnowflakeType"},+ "client_secret": {"description": "The application client secret", "type": "string"}+ },+ "required": ["grant_type", "refresh_token"]+ },+ "AuthorizationCodeTokenRequest": {+ "type": "object",+ "properties": {+ "grant_type": {+ "type": "string",+ "const": "authorization_code",+ "description": "The grant type for exchanging an authorization code"+ },+ "code": {"description": "The authorization code received from the authorize endpoint", "type": "string"},+ "redirect_uri": {"description": "The redirect URI used in the authorization request", "type": "string"},+ "client_id": {"description": "The application client ID", "$ref": "#/components/schemas/SnowflakeType"},+ "client_secret": {"description": "The application client secret", "type": "string"},+ "code_verifier": {"description": "The PKCE code verifier for the authorization request", "type": "string"}+ },+ "required": ["grant_type", "code", "redirect_uri"]+ },"TokenTypeHint": {"description": "A hint about the type of token being revoked","x-enumNames": ["ACCESS_TOKEN", "REFRESH_TOKEN"],@@ -33371,6 +32859,96 @@"switch_in_progress"]},+ "IneligibleSwitchToListPriceResponse": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "const": "ineligible",+ "description": "The subscription cannot be moved to the current list price"+ },+ "reason": {+ "description": "Why the switch was refused",+ "$ref": "#/components/schemas/ListPriceSwitchIneligibilityReason"+ }+ },+ "required": ["status", "reason"],+ "additionalProperties": false+ },+ "AlreadyScheduledSwitchToListPriceResponse": {+ "type": "object",+ "properties": {+ "effective_at": {"type": "string", "description": "ISO timestamp the switch takes effect"},+ "target_price_id": {+ "type": "string",+ "description": "Stripe price ID the subscription will be billed against after the switch"+ },+ "target_amount_minor": {+ "type": "integer",+ "minimum": -9007199254740991,+ "maximum": 9007199254740991,+ "description": "Amount billed after the switch, in the currency minor unit"+ },+ "current_amount_minor": {+ "type": "integer",+ "minimum": -9007199254740991,+ "maximum": 9007199254740991,+ "description": "Amount billed before the switch, in the currency minor unit"+ },+ "currency": {"description": "Currency of both amounts", "$ref": "#/components/schemas/PremiumCurrency"},+ "status": {+ "type": "string",+ "const": "already_scheduled",+ "description": "The switch was already scheduled by an earlier request"+ }+ },+ "required": [+ "effective_at",+ "target_price_id",+ "target_amount_minor",+ "current_amount_minor",+ "currency",+ "status"+ ],+ "additionalProperties": false+ },+ "ScheduledSwitchToListPriceResponse": {+ "type": "object",+ "properties": {+ "effective_at": {"type": "string", "description": "ISO timestamp the switch takes effect"},+ "target_price_id": {+ "type": "string",+ "description": "Stripe price ID the subscription will be billed against after the switch"+ },+ "target_amount_minor": {+ "type": "integer",+ "minimum": -9007199254740991,+ "maximum": 9007199254740991,+ "description": "Amount billed after the switch, in the currency minor unit"+ },+ "current_amount_minor": {+ "type": "integer",+ "minimum": -9007199254740991,+ "maximum": 9007199254740991,+ "description": "Amount billed before the switch, in the currency minor unit"+ },+ "currency": {"description": "Currency of both amounts", "$ref": "#/components/schemas/PremiumCurrency"},+ "status": {+ "type": "string",+ "const": "scheduled",+ "description": "The switch was scheduled for the end of the current billing period"+ }+ },+ "required": [+ "effective_at",+ "target_price_id",+ "target_amount_minor",+ "current_amount_minor",+ "currency",+ "status"+ ],+ "additionalProperties": false+ },"ReadStateResponse": {"type": "object","properties": {@@ -33399,39 +32977,411 @@"additionalProperties": false},"UnsignedInt64StringType": {"type": "string", "pattern": "^\\d+$", "format": "int64"},- "GuildReportCategory": {- "description": "Category of the guild report",+ "GuildDsaReportRequest": {+ "type": "object",+ "properties": {+ "ticket": {"description": "Verification ticket obtained from email verification", "type": "string"},+ "additional_info": {"description": "Additional context or details about the report", "type": "string"},+ "reporter_full_legal_name": {+ "description": "Full legal name of the person filing the report",+ "type": "string"+ },+ "reporter_country_of_residence": {+ "description": "EU country code of the reporter residence",+ "x-enumNames": [+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE"+ ],+ "x-enumDescriptions": [+ "Austria",+ "Belgium",+ "Bulgaria",+ "Croatia",+ "Cyprus",+ "Czechia",+ "Denmark",+ "Estonia",+ "Finland",+ "France",+ "Germany",+ "Greece",+ "Hungary",+ "Ireland",+ "Italy",+ "Latvia",+ "Lithuania",+ "Luxembourg",+ "Malta",+ "Netherlands",+ "Poland",+ "Portugal",+ "Romania",+ "Slovakia",+ "Slovenia",+ "Spain",+ "Sweden"+ ],+ "enum": [+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE"+ ],+ "type": "string"+ },+ "reporter_fluxer_tag": {+ "description": "Fluxer tag of the reporter if they have an account",+ "type": "string",+ "minLength": 3,+ "maxLength": 37+ },+ "report_type": {"type": "string", "const": "guild", "description": "Type of report"},+ "category": {"$ref": "#/components/schemas/GuildReportCategory"},+ "guild_id": {"description": "ID of the guild being reported", "$ref": "#/components/schemas/SnowflakeType"},+ "invite_code": {"description": "Invite code used to access the guild", "type": "string"}+ },+ "required": [+ "ticket",+ "reporter_full_legal_name",+ "reporter_country_of_residence",+ "report_type",+ "category",+ "guild_id"+ ]+ },+ "UserDsaReportRequest": {+ "type": "object",+ "properties": {+ "ticket": {"description": "Verification ticket obtained from email verification", "type": "string"},+ "additional_info": {"description": "Additional context or details about the report", "type": "string"},+ "reporter_full_legal_name": {+ "description": "Full legal name of the person filing the report",+ "type": "string"+ },+ "reporter_country_of_residence": {+ "description": "EU country code of the reporter residence",+ "x-enumNames": [+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE"+ ],+ "x-enumDescriptions": [+ "Austria",+ "Belgium",+ "Bulgaria",+ "Croatia",+ "Cyprus",+ "Czechia",+ "Denmark",+ "Estonia",+ "Finland",+ "France",+ "Germany",+ "Greece",+ "Hungary",+ "Ireland",+ "Italy",+ "Latvia",+ "Lithuania",+ "Luxembourg",+ "Malta",+ "Netherlands",+ "Poland",+ "Portugal",+ "Romania",+ "Slovakia",+ "Slovenia",+ "Spain",+ "Sweden"+ ],+ "enum": [+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE"+ ],+ "type": "string"+ },+ "reporter_fluxer_tag": {+ "description": "Fluxer tag of the reporter if they have an account",+ "type": "string",+ "minLength": 3,+ "maxLength": 37+ },+ "report_type": {"type": "string", "const": "user", "description": "Type of report"},+ "category": {"$ref": "#/components/schemas/UserReportCategory"},+ "user_id": {"description": "ID of the user being reported", "$ref": "#/components/schemas/SnowflakeType"},+ "user_tag": {+ "description": "Fluxer tag of the user being reported",+ "type": "string",+ "minLength": 3,+ "maxLength": 37+ }+ },+ "required": ["ticket", "reporter_full_legal_name", "reporter_country_of_residence", "report_type", "category"]+ },+ "MessageDsaReportRequest": {+ "type": "object",+ "properties": {+ "ticket": {"description": "Verification ticket obtained from email verification", "type": "string"},+ "additional_info": {"description": "Additional context or details about the report", "type": "string"},+ "reporter_full_legal_name": {+ "description": "Full legal name of the person filing the report",+ "type": "string"+ },+ "reporter_country_of_residence": {+ "description": "EU country code of the reporter residence",+ "x-enumNames": [+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE"+ ],+ "x-enumDescriptions": [+ "Austria",+ "Belgium",+ "Bulgaria",+ "Croatia",+ "Cyprus",+ "Czechia",+ "Denmark",+ "Estonia",+ "Finland",+ "France",+ "Germany",+ "Greece",+ "Hungary",+ "Ireland",+ "Italy",+ "Latvia",+ "Lithuania",+ "Luxembourg",+ "Malta",+ "Netherlands",+ "Poland",+ "Portugal",+ "Romania",+ "Slovakia",+ "Slovenia",+ "Spain",+ "Sweden"+ ],+ "enum": [+ "AT",+ "BE",+ "BG",+ "HR",+ "CY",+ "CZ",+ "DK",+ "EE",+ "FI",+ "FR",+ "DE",+ "GR",+ "HU",+ "IE",+ "IT",+ "LV",+ "LT",+ "LU",+ "MT",+ "NL",+ "PL",+ "PT",+ "RO",+ "SK",+ "SI",+ "ES",+ "SE"+ ],+ "type": "string"+ },+ "reporter_fluxer_tag": {+ "description": "Fluxer tag of the reporter if they have an account",+ "type": "string",+ "minLength": 3,+ "maxLength": 37+ },+ "report_type": {"type": "string", "const": "message", "description": "Type of report"},+ "category": {"$ref": "#/components/schemas/MessageReportCategory"},+ "message_link": {"description": "Link to the message being reported", "type": "string"},+ "reported_user_tag": {+ "description": "Fluxer tag of the user who sent the message",+ "type": "string",+ "minLength": 3,+ "maxLength": 37+ }+ },+ "required": [+ "ticket",+ "reporter_full_legal_name",+ "reporter_country_of_residence",+ "report_type",+ "category",+ "message_link"+ ]+ },+ "MessageReportCategory": {+ "description": "Category of the message report","x-enumNames": ["harassment","hate_speech",- "extremist_community",+ "violent_content",+ "spam",+ "nsfw_violation","illegal_activity",+ "doxxing",+ "self_harm","child_safety",- "raid_coordination",- "spam",- "malware_distribution",+ "malicious_links",+ "impersonation","other"],"x-enumDescriptions": [- "Guild facilitates harassment, bullying, or intimidation",- "Guild promotes hatred against protected groups",- "Guild promotes extremist or terrorist ideologies",- "Guild promotes or facilitates illegal activities",- "Guild endangers minors or hosts child abuse content",- "Guild coordinates attacks on other communities",- "Guild used for spamming or bulk messaging",- "Guild distributes malware or malicious software",+ "Content that harasses, bullies, or intimidates users",+ "Content promoting hatred against protected groups",+ "Content depicting or promoting violence",+ "Unsolicited bulk messages or promotional content",+ "Adult content posted outside age-restricted channels",+ "Content promoting or facilitating illegal activities",+ "Content revealing private personal information",+ "Content promoting self-harm or suicide",+ "Content that endangers minors or depicts child abuse",+ "Links to malware, phishing, or other malicious sites",+ "Content falsely claiming to be another person or entity","Other violations not covered by specific categories"],"enum": ["harassment","hate_speech",- "extremist_community",+ "violent_content",+ "spam",+ "nsfw_violation","illegal_activity",+ "doxxing",+ "self_harm","child_safety",- "raid_coordination",- "spam",- "malware_distribution",+ "malicious_links",+ "impersonation","other"],"type": "string"@@ -33467,48 +33417,39 @@],"type": "string"},- "MessageReportCategory": {- "description": "Category of the message report",+ "GuildReportCategory": {+ "description": "Category of the guild report","x-enumNames": ["harassment","hate_speech",- "violent_content",- "spam",- "nsfw_violation",+ "extremist_community","illegal_activity",- "doxxing",- "self_harm","child_safety",- "malicious_links",- "impersonation",+ "raid_coordination",+ "spam",+ "malware_distribution","other"],"x-enumDescriptions": [- "Content that harasses, bullies, or intimidates users",- "Content promoting hatred against protected groups",- "Content depicting or promoting violence",- "Unsolicited bulk messages or promotional content",- "Adult content posted outside age-restricted channels",- "Content promoting or facilitating illegal activities",- "Content revealing private personal information",- "Content promoting self-harm or suicide",- "Content that endangers minors or depicts child abuse",- "Links to malware, phishing, or other malicious sites",- "Content falsely claiming to be another person or entity",+ "Guild facilitates harassment, bullying, or intimidation",+ "Guild promotes hatred against protected groups",+ "Guild promotes extremist or terrorist ideologies",+ "Guild promotes or facilitates illegal activities",+ "Guild endangers minors or hosts child abuse content",+ "Guild coordinates attacks on other communities",+ "Guild used for spamming or bulk messaging",+ "Guild distributes malware or malicious software","Other violations not covered by specific categories"],"enum": ["harassment","hate_speech",- "violent_content",- "spam",- "nsfw_violation",+ "extremist_community","illegal_activity",- "doxxing",- "self_harm","child_safety",- "malicious_links",- "impersonation",+ "raid_coordination",+ "spam",+ "malware_distribution","other"],"type": "string"@@ -33826,6 +33767,71 @@"type": "string"},"CheckoutPaymentMethodEnum": {"type": "string", "enum": ["card", "pix", "upi"]},+ "ExpiredLocalizedCardPreapprovalContinueResponse": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "const": "expired",+ "description": "The preapproval token has expired or is unknown"+ }+ },+ "required": ["status"],+ "additionalProperties": false+ },+ "RejectedLocalizedCardPreapprovalContinueResponse": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "const": "rejected",+ "description": "The preapproval failed and the paid checkout should not continue"+ },+ "reason": {+ "type": "string",+ "enum": [+ "country_mismatch",+ "missing_customer",+ "missing_payment_method",+ "missing_setup_intent",+ "payment_method_not_card",+ "unknown"+ ],+ "description": "The reason the preapproval was rejected"+ },+ "actual_country": {+ "description": "The detected card issuing country when available",+ "anyOf": [{"type": "string", "minLength": 2, "maxLength": 2}, {"type": "null"}]+ }+ },+ "required": ["status", "reason"],+ "additionalProperties": false+ },+ "ReadyLocalizedCardPreapprovalContinueResponse": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "const": "ready",+ "description": "The preapproval succeeded and the paid checkout URL is ready"+ },+ "url": {"type": "string", "description": "The URL to redirect to"}+ },+ "required": ["status", "url"],+ "additionalProperties": false+ },+ "PendingLocalizedCardPreapprovalContinueResponse": {+ "type": "object",+ "properties": {+ "status": {+ "type": "string",+ "const": "pending",+ "description": "The preapproval result is still being processed"+ }+ },+ "required": ["status"],+ "additionalProperties": false+ },"GifCategoryTagResponse": {"type": "object","properties": {diff --git a/packages/openapi/src/OpenAPIGenerator.ts b/packages/openapi/src/OpenAPIGenerator.tsindex e78b3d70a..dddec78af 100644--- a/packages/openapi/src/OpenAPIGenerator.ts+++ b/packages/openapi/src/OpenAPIGenerator.ts@@ -67,7 +67,7 @@ export class OpenAPIGenerator {return result.document;}public async generateWithStats(): Promise<OpenAPIGenerationResult> {- const schemaRegistry = new SchemaRegistry(this.settings.schemaTarget);+ const schemaRegistry = new SchemaRegistry(this.settings.schemaTarget, this.settings.routeScope !== 'admin');const controllerFiles = discoverControllerFiles(`${this.settings.basePath}/fluxer_api`);const routes = this.filterRoutesForScope(extractRoutesFromControllers(controllerFiles));await loadSchemasIntoRegistry(this.settings.basePath, schemaRegistry);diff --git a/packages/openapi/src/converters/ZodToOpenAPI.ts b/packages/openapi/src/converters/ZodToOpenAPI.tsindex 5011a13d8..90d7190e4 100644--- a/packages/openapi/src/converters/ZodToOpenAPI.ts+++ b/packages/openapi/src/converters/ZodToOpenAPI.ts@@ -5,7 +5,7 @@ import type {OpenAPISchemaTarget} from '@fluxer/openapi/src/OpenAPIGenerationTypimport {visitOpenAPISchemaObjects} from '@fluxer/openapi/src/OpenAPISchemaVisitor';import type {OpenAPIDocument, OpenAPIRef, OpenAPISchema} from '@fluxer/openapi/src/OpenAPITypes';import {schemaMetadata} from '@fluxer/schema/src/SchemaMetadata';-import {type core, z} from 'zod';+import {core, z} from 'zod';export type SchemaIO = 'input' | 'output';@@ -76,6 +76,25 @@ function renameComponentRefs(value: unknown, renames: Map<string, string>): void});}+function toPascalCase(value: string): string {+ return value+ .split(/[^A-Za-z0-9]+/)+ .filter((word) => word.length > 0)+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())+ .join('');+}++function branchNamePrefix(discriminator: core.JSONSchema._JSONSchema | undefined): string | undefined {+ if (typeof discriminator !== 'object') return undefined;+ const enumNames = discriminator['x-enumNames'];+ const value = Array.isArray(enumNames)+ ? enumNames[0]+ : discriminator.enum?.length === 1+ ? discriminator.enum[0]+ : discriminator.const;+ return typeof value === 'string' ? toPascalCase(value) : undefined;+}+function removeRedundantReferenceProperties(value: unknown, schemas: Record<string, OpenAPISchema>): void {visitOpenAPISchemaObjects(value, (schema) => {const refs = [schema.$ref, ...(schema.allOf ?? []).map((branch) => branch.$ref)];@@ -99,7 +118,10 @@ export class ZodOpenAPIConverter {private readonly worklist: Array<PendingSchema> = [];private nextPendingIndex = 0;- constructor(private readonly target: OpenAPISchemaTarget) {}+ constructor(+ private readonly target: OpenAPISchemaTarget,+ private readonly nameUnionBranches = false,+ ) {}register(name: string, schema: core.$ZodType): void {validateOpenAPIComponentName(name);@@ -164,6 +186,24 @@ export class ZodOpenAPIConverter {removeRedundantReferenceProperties(document, document.components.schemas);}+ private nameDiscriminatedUnionBranches(+ unionName: string,+ schema: core.$ZodType,+ json: OpenAPISchema,+ io: SchemaIO,+ ): void {+ if (!(schema instanceof core.$ZodDiscriminatedUnion) || !json.oneOf) return;+ const {discriminator, options} = schema._zod.def;+ const usedPrefixes = new Set<string>();+ json.oneOf = json.oneOf.map((branch, index) => {+ if (branch.$ref) return branch;+ const base = branchNamePrefix(branch.properties?.[discriminator]) ?? `Variant${index}`;+ const prefix = usedPrefixes.has(base) ? `${base}${index}` : base;+ usedPrefixes.add(prefix);+ return this.getRef(`${prefix}${unionName}`, options[index], io);+ });+ }+private convertPending(): void {while (this.nextPendingIndex < this.worklist.length) {const pending = this.worklist[this.nextPendingIndex];@@ -193,6 +233,8 @@ export class ZodOpenAPIConverter {const ref = this.getRef(name, zodSchema, io);replaceSchema(jsonSchema, description ? {...ref, description} : ref);}+ } else if (this.nameUnionBranches) {+ this.nameDiscriminatedUnionBranches(pending.name, zodSchema, jsonSchema, io);}if (this.target === 'openapi-3.0' && jsonSchema.$ref && Object.keys(jsonSchema).length > 1) {const ref = {$ref: jsonSchema.$ref};diff --git a/packages/openapi/src/converters/__tests__/ZodToOpenAPI.test.ts b/packages/openapi/src/converters/__tests__/ZodToOpenAPI.test.tsindex 9f2263588..11d50d4ec 100644--- a/packages/openapi/src/converters/__tests__/ZodToOpenAPI.test.ts+++ b/packages/openapi/src/converters/__tests__/ZodToOpenAPI.test.ts@@ -2,7 +2,7 @@ import {ZodOpenAPIConverter} from '@fluxer/openapi/src/converters/ZodToOpenAPI';import type {OpenAPIDocument} from '@fluxer/openapi/src/OpenAPITypes';import {SudoVerificationSchema} from '@fluxer/schema/src/domains/auth/AuthSchemas';import {HarvestArchiveResponse} from '@fluxer/schema/src/domains/user/UserHarvestSchemas';-import {SnowflakeType, withOpenApiType} from '@fluxer/schema/src/primitives/SchemaPrimitives';+import {createNamedLiteral, SnowflakeType, withOpenApiType} from '@fluxer/schema/src/primitives/SchemaPrimitives';import {describe, expect, it} from 'vitest';import {z} from 'zod';@@ -122,6 +122,34 @@ describe('native Zod conversion', () => {);});+ it('names discriminated union branches after their discriminator value', () => {+ const union = z.discriminatedUnion('kind', [+ z.object({kind: createNamedLiteral(0, 'GUILD_TEXT'), name: z.string()}),+ z.object({kind: z.literal('refresh_token'), token: z.string()}),+ z.object({kind: z.literal(7), size: z.number()}),+ ]);+ const converter = new ZodOpenAPIConverter('draft-2020-12', true);+ converter.getRef('Request', union, 'input');+ const document = documentFor(converter);+ converter.normalizeComponents(document);+ expect(document.components.schemas.Request.oneOf).toEqual([+ {$ref: '#/components/schemas/GuildTextRequest'},+ {$ref: '#/components/schemas/RefreshTokenRequest'},+ {$ref: '#/components/schemas/Variant2Request'},+ ]);+ expect(document.components.schemas.GuildTextRequest.properties).toHaveProperty('name');+ expect(document.components.schemas.RefreshTokenRequest.properties).toHaveProperty('token');+ expect(document.components.schemas.Variant2Request.properties).toHaveProperty('size');+ });++ it('keeps discriminated union branches inline unless asked to name them', () => {+ const union = z.discriminatedUnion('kind', [z.object({kind: z.literal('a')}), z.object({kind: z.literal('b')})]);+ const converter = new ZodOpenAPIConverter('openapi-3.0');+ const schema = converter.getSchema('Request', union, 'input');+ expect(schema.oneOf?.map((branch) => branch.$ref)).toEqual([undefined, undefined]);+ expect(Object.keys(converter.getAllSchemas())).toEqual(['RequestInput']);+ });+it('converts newly discovered components after an earlier conversion pass', () => {const converter = new ZodOpenAPIConverter('draft-2020-12');converter.getSchema('First', z.string(), 'input');diff --git a/packages/openapi/src/registry/SchemaRegistry.ts b/packages/openapi/src/registry/SchemaRegistry.tsindex 0d9a622bb..a3d03b657 100644--- a/packages/openapi/src/registry/SchemaRegistry.ts+++ b/packages/openapi/src/registry/SchemaRegistry.ts@@ -12,8 +12,8 @@ export class SchemaRegistry {private readonly emptyObjectAcceptance = new WeakMap<core.$ZodType, boolean>();private readonly converter: ZodOpenAPIConverter;- constructor(target: OpenAPISchemaTarget = 'draft-2020-12') {- this.converter = new ZodOpenAPIConverter(target);+ constructor(target: OpenAPISchemaTarget = 'draft-2020-12', nameUnionBranches = false) {+ this.converter = new ZodOpenAPIConverter(target, nameUnionBranches);}register(name: string, schema: OpenAPISchema): void {