Skip to content

Conversation

@lohanidamodar
Copy link
Contributor

  • When an optional parameter is sent in the request with explicit null value, set it to default if provided

…ssing

- When an optional parameter is sent in the request with explicit `null` value, set it to default if provided
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-optional-default-param

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

$paramExists = $existsInRequest || $existsInValues;

if ($existsInRequest) {
if ($existsInRequest && !($param['optional'] && $requestParams[$key] === null)) {
Copy link
Member

Choose a reason for hiding this comment

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

What if we want to actually pass null to an optional param?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what should we do? should we check if validator is nullable ? what do we do? if null value is supported, shouldn't default be null? do we have a case where we support null but also have something else as default value?

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