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

Allow requests to be serialized as nothing instead of an empty object #926

Merged
merged 5 commits into from
Jan 23, 2025

Conversation

swallez
Copy link
Member

@swallez swallez commented Jan 21, 2025

Allow requests that have all-optional properties to be serialized as an empty body (zero bytes) instead of an empty object ({})

Some endpoints (e.g. /_validate/query) require this behavior and reject requests that have an empty object body.

This is achieved by wrapping the body accessor in endpoint definitions using EndpointBase.nonEmptyJsonObject(bodyGetter). This will be added to the relevant endpoints in the code generator.

@l-trotta
Copy link
Contributor

fixes #924

@swallez swallez merged commit d78f01e into main Jan 23, 2025
7 checks passed
@swallez swallez deleted the optional-request-body branch January 23, 2025 14:51
Copy link

The backport to 8.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.x 8.x
# Navigate to the new working tree
cd .worktrees/backport-8.x
# Create a new branch
git switch --create backport-926-to-8.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick --mainline 1 d78f01e99bbc3048f2d0a5e68165e30f1163352c
# Push it to GitHub
git push --set-upstream origin backport-926-to-8.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.x

Then, create a pull request where the base branch is 8.x and the compare/head branch is backport-926-to-8.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants