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

Support nullable objects in the RequestBuilder.param() method #80

Open
arbue opened this issue Jun 24, 2021 · 0 comments
Open

Support nullable objects in the RequestBuilder.param() method #80

arbue opened this issue Jun 24, 2021 · 0 comments

Comments

@arbue
Copy link

arbue commented Jun 24, 2021

Hi,

is there a way to pass nullable values to the param method so that it is not included in the serialized string as a null value.

If there is no existing way could you add a new method to the RequestBuilder class which for example just skips setting null values to the newObjectParams object.

   @NotNull
    public RequestBuilder<T> paramNullable(@NotNull String name, Object value) {
        ObjectNode newObjectParams = objectParams.deepCopy();
        if(value != null){
            newObjectParams.set(name, mapper.valueToTree(value));
        }
        return new RequestBuilder<T>(transport, mapper, method, id, newObjectParams, arrayParams, javaType);
    }

I could also provide a PR with that change if you like.

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

No branches or pull requests

1 participant