Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to fix guild response schemas #1180

Conversation

DEVTomatoCake
Copy link
Member

Initial bug: Creating a guild (POST /api/guilds) returns a lot more properties than just id.

Looking at this more, some schemas extended Guild which caused them to include properties like system_channel (not system_channel_id) or channel_ordering, both of which aren't returned in the response when stringifying a guild.

I'm not really sure about using | undefined as type, it's used in IReadyGuildDTO - they might have to be marked as nullable/optional instead.

Looking at the generated schema (replace with spec-url="https://raw.githubusercontent.com/DEVTomatoCake/spacebar-server/fix/guild-create-response-schema/assets/openapi.json" in <rapi-doc> on https://docs.spacebar.chat/routes/#patch-/guilds/-guild_id-/) looks better.

@@ -26,7 +26,6 @@ export interface GuildCreateSchema {
region?: string;
icon?: string | null;
channels?: ChannelModifySchema[];
guild_template_code?: string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exists nowhere else...?

export interface GuildUpdateSchema
extends Omit<GuildCreateSchema, "channels" | "name"> {
name?: string;
export interface GuildUpdateSchema extends Omit<GuildCreateSchema, "channels"> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified this, the name property has the same type for both so why not reuse it.

@MaddyUnderStars
Copy link
Member

When you can, could you fix the schema conflict, then I'll merge

@MaddyUnderStars MaddyUnderStars merged commit f00a315 into spacebarchat:master Aug 22, 2024
3 checks passed
@DEVTomatoCake DEVTomatoCake deleted the fix/guild-create-response-schema branch August 22, 2024 04:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants