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

feat: Make boolean quirk an enum #45

Merged
merged 2 commits into from
Dec 21, 2023
Merged

Conversation

provokateurin
Copy link
Member

For query parameters we have to convert booleans into integers as they are only accepted that way. This sets the enum field on the returned integer schema to indicate that these are the only possible values.
Can be tested in the server.

@nickvergessen
Copy link
Member

Conflicting files
src/OpenApiType.php

@provokateurin provokateurin force-pushed the feat/boolean-quirk-enum branch from 9efa1ef to 299fea3 Compare December 14, 2023 06:48
@provokateurin
Copy link
Member Author

Fixed

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

So at least bools only allow int with enum 0 and 1 now, so better than before.
But shouldn't it be listed as bool?

@nickvergessen nickvergessen merged commit cbf8396 into main Dec 21, 2023
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the feat/boolean-quirk-enum branch December 21, 2023 10:58
@provokateurin
Copy link
Member Author

The problem is that query parameters are always interpreted as true unless the value is 0. So we need to map them as integers :/

@nickvergessen
Copy link
Member

Added tests in #59

@nickvergessen
Copy link
Member

The problem is that query parameters are always interpreted as true unless the value is 0.

But not when you POST a JSON body, but it will work in both cases anyway, so okay

@provokateurin
Copy link
Member Author

Yes with a json post body boolean works fine, but not with the query parameters as we use them here.

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