Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@blueo
Copy link
Contributor

@blueo blueo commented Aug 6, 2025

Currently, when a request body is specified as an array of primitive values, the AbstractBodyContentGenerator will add an array type check for the first item of an array. This results in a client that never sends a request body when you pass an array of primitive values. This fix changes it to a simpler is_array. It also removes the isset check for the first item as an empty array is valid if no min items are set

fixes #828

feels like there's a opportunity to use the validators in here but I couldn't quite see how and thought a simpler change would be easier.

@blueo blueo force-pushed the bugfix/request-body-get-body-typecheck branch from 4f2c6c4 to 3eb6cbe Compare August 6, 2025 04:59
Copy link
Member

@Korbeil Korbeil left a comment

Choose a reason for hiding this comment

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

I don't think validators will work here. We inject validators when required inside serialization / deserialization so it's totaly transparent when using Jane. Since there is no "object" in your case, you cannot use theses validators.

Could you fix CS & add a quick note about your changes in the CHANGELOG file please ? 🙏

@blueo blueo force-pushed the bugfix/request-body-get-body-typecheck branch from 3eb6cbe to 6eeee84 Compare September 1, 2025 04:14
@blueo
Copy link
Contributor Author

blueo commented Sep 1, 2025

ah right cool my hunch was wrong :) will fix up the CI + changelog

@Korbeil
Copy link
Member

Korbeil commented Sep 1, 2025

ah right cool my hunch was wrong :) will fix up the CI + changelog

I did fixed some comments issue on next branch, could you rebase & regenerate tests fixtures so tests shows green again ? Thanks !

Currently, when a request body is specified as an array of primitive values, the AbstractBodyContentGenerator will add an array type check for the first item of an array.
This results in a client that never sends a request body when you pass an array of primitive values. This fix changes it to a simpler `is_array` check.
@blueo blueo force-pushed the bugfix/request-body-get-body-typecheck branch from 6eeee84 to 950b149 Compare September 2, 2025 21:32
@Korbeil
Copy link
Member

Korbeil commented Sep 2, 2025

Thanks for fixing all this !

@Korbeil Korbeil merged commit 0215478 into janephp:next Sep 2, 2025
7 checks passed
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.

Request body with array of primitive are not correctly generated

2 participants