Skip to content

Add warning about boolean metadata fields #5807

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

Closed
wants to merge 1 commit into from

Conversation

advaith1
Copy link
Contributor

When setting metadata on a user, you would assume that you need to set boolean fields to true or false, but you actually need to use 1 or 0. This has caused problems (especially because no error is returned) so I added a warning box to make it clear.

@Lulalaby
Copy link
Contributor

Had a talk with a staff about it and they had a talk with the team. Apparently it's documented enough the way it is and the examples were updated accordingly to reflect this.

Don't think a warning is needed. Maybe use instead a footnote?

  • only accepts 0/1, not true/false

@Nihlus
Copy link
Contributor

Nihlus commented Jan 2, 2023

If it's supposed to be a boolean field, 0/1 is just plainly the wrong type. This is a big fat major gotcha that really deserves the large warning label.

@mbialecka
Copy link
Contributor

Not sure why one would assume so if it's explicitly documented already.

@mbialecka mbialecka closed this Jan 6, 2023
@Nihlus
Copy link
Contributor

Nihlus commented Jan 6, 2023

I really think you should reconsider closing this issue. Adding a warning is the very least you should do, but the better option would be to document it properly. It's not explicitly documented; that's the whole problem.

@Rapptz
Copy link
Contributor

Rapptz commented Jan 6, 2023

Not sure why one would assume so if it's explicitly documented already.

The assumption that something called a boolean would accept boolean values instead of 0 and 1 is one that anyone would make. A callout warning is the minimum that should be done to avoid this bizarre limitation and design quirk in the API.

@yonilerner
Copy link
Member

To clarify: the user request at https://discord.com/developers/docs/resources/user#update-user-application-role-connection links to https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object to describe what the metadata object is, and that table clearly indicates that the expected value for boolean types is an integer.

@Mehgugs
Copy link
Contributor

Mehgugs commented Jan 6, 2023

I think this table is falling victim to shove it all in the description column and I don't think adding a warning to confusing docs is solving the real issue here.

Examples of how the table could be improved:

Name Value JSON type Acceptable Metadata Values Description
DATETIME_LESS_THAN_OR_EQUAL 5 string an ISO8601 formatted date Checks that the user's metadata value is before or the same as the guild's configured value.
BOOLEAN_EQUAL 7 integer 0, 1 Checks that the user's metadata value is equal to the guild's configured value.

I think something like this would be better for clarifying. I don't think we need to include the type the guild uses internally, from the perspective of the application metadata we dont really care how the guild data is collected from server admins at this stage in the api's flow.

In addition to these changes I also think this feature needs a dedicated write up in the docs, and that is the place that the guild settings perspective and how it relates to the metadata should be explained.

@shaydewael
Copy link
Contributor

shaydewael commented Jan 6, 2023

I opened a new issue #5827 to track this—I agree with others that this info shouldn't live here so I don't think we should reopen this PR, but I'll look at reworking connection metadata docs in general to try to clear this up and hopefully make it more explicit. @Mehgugs's idea seems like a step in the right direction.

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.

8 participants