Skip to content

RemoveItems converts empty maps and lists ({} and []) instead to null #305

@pjiang-dev

Description

@pjiang-dev

I'm experiencing a similar issue as #302 except for RemoveItems()

For example in my CronJob jobTempalte i end up with a metadata: null which is not a nullable field

  "spec": {
    "concurrencyPolicy": "Allow",
    "failedJobsHistoryLimit": 1,
    "jobTemplate": {
      "metadata": null,

We should do the same as Extract items and preserve empty list/maps

# Starting value
mapOfMaps:
  b:
    a: "x"
    c: "z"

# Call RemoveItems to remove all nested fields
RemoveItems(mapOfMaps.b.a, mapOfMaps.b.c)

# BUG: Returns null
mapOfMaps:
  b: null

In my case the list/map is not empty before calling RemoveItems(). Only after calling RemoveItems() then the list/map is empty and returns null.

I think the correct behavior is we preserve the list or map if it becomes empty after using RemoveItems

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions