Skip to content

Fix boolean query parameters - #14

Merged
pavog merged 3 commits into
masterfrom
fix-boolean-query-parameters
Oct 15, 2026
Merged

pavog merged 3 commits into
masterfrom
fix-boolean-query-parameters

Conversation

@pavog

@pavog pavog commented Oct 15, 2026

Copy link
Copy Markdown
Member

The client sets the boolean format for query parameters to strings (true/false) on its configuration, but the generated ObjectSerializer reads this format from Configuration::getDefaultConfiguration().

See ObjectSerializer->convertBoolToQueryStringFormat():

    /**
     * Convert boolean value to format for query string.
     *
     * @param bool $value Boolean value
     *
     * @return int|string Boolean value in format
     */
    public static function convertBoolToQueryStringFormat(bool $value): int|string
    {
        if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) {
            return $value ? 'true' : 'false';
        }

        return (int) $value;
    }

When a custom configuration is passed to the client, boolean query parameters are therefore sent as 1/0.

The CurseForge API ignores these values. For example getCategories(432, null, true) sent classesOnly=1 and returned all 148 categories instead of the 9 classes. This affects every boolean parameter, e.g. classesOnly, clientCompatible and includeAll.

setConfiguration() now also sets the format on the default configuration.

@pavog
pavog requested a review from JulianVennen October 15, 2026 16:05
@pavog
pavog merged commit 42541b8 into master Oct 15, 2026
5 checks passed
@pavog
pavog deleted the fix-boolean-query-parameters branch October 15, 2026 17:00
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