Skip to content

Conversation

@williewheeler
Copy link

No description provided.

Choose a reason for hiding this comment

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

You know fromVal will not be null since fromVal is already checked not to be null at line 40?

Also this logic is not right...

Copy link
Author

Choose a reason for hiding this comment

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

Hi saintcoder. Thanks for the feedback. Line 40 (red) is the line I removed and replaced with the following code (green). With that background, if there is still a logic issue, please explain.

Choose a reason for hiding this comment

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

How the code determine whether the client has explicitly sent a property with a null value (in which case, you want to set the property to null) as opposed to the client not sending the property at all (in which case, it should be ignored)? To be specific, how does fromWrapper.getProperty(persistentProperty) know if the property is explicitly sent?

Copy link
Author

Choose a reason for hiding this comment

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

Good question.

With a PUT, the incoming representation is supposed to replace--wholly--any existing representation. Certainly if the client explicitly nulls out a property, it should be null on the backend. But given PUT semantics I would argue that if the client does not include the property at all, then that amounts to a null or else some default value, but not simply ignoring the property.

I would suggest that SDR use HTTP PATCH to accomplish property-level updates.

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

Labels

None yet

3 participants