Skip to content

Conversation

@valentinEmpy
Copy link
Contributor

As per documentation in order to delete labels/annotations from a resource's metadata, one must:

To delete, include the existing key with a null value.

Explained in: https://v3-apidocs.cloudfoundry.org/version/3.80.0/index.html#Using-labels-and-annotations

The Immutables class includes AllowNulls annotation but does not have JsonInclude. This makes the default ObjectMapper which is initialized using setSerializationInclusion(NON_NULL) to IGNORE the null mappings in the label/annotation maps and does not serialize them when sending the request to the controller. This in turn, does not allow the deletion of Metadata keys at all.
Using JsonInclude annotation overriding the default serialization inclusion handles this issue.

@valentinEmpy
Copy link
Contributor Author

valentinEmpy commented Feb 12, 2020

There's the possibility to provide a custom ObjectMapper with a different default serialization inclusion but this would lead to side effects of other calls we do, hence there is no way for us to delete metadata labels/annotations.

@valentinEmpy valentinEmpy requested a review from twoseat February 12, 2020 20:54
@twoseat twoseat self-assigned this Feb 14, 2020
@twoseat twoseat added this to the 3.21.0.RELEASE milestone Feb 17, 2020
@twoseat twoseat closed this in 1b91c9a Feb 17, 2020
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