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

Requests with null value fields #114

Open
XtraSonic opened this issue Nov 19, 2020 · 0 comments
Open

Requests with null value fields #114

XtraSonic opened this issue Nov 19, 2020 · 0 comments

Comments

@XtraSonic
Copy link
Contributor

JSONObject, which is used to create the payload of the request, does not put fields in the payload if they have the value (java) null. If we want to add a field with the value null, it has to have the value "JSONObject.NULL" (see the json object documentation)

There are two ways we can handle this:

  1. Create a NullFieldModel class which gets a name and always returns the value JSONObject.NULL. When the user wants to set a field with a null value, it will create a new instance of this class and set it in the entity model.

  2. Treat all null values as JSONObject.NULL. This might have a backwards compatibility impact since now some fields which were previously ignored, will be added to the request and will have the value null.

I personally think that the first option is better.

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

No branches or pull requests

1 participant