DataObjectQuery#copyObject does not copy GeoWithinFilterBean correctly

LEAF JS Core Version: 3.4.1

Expected Behavior:
Running copyObject on a DataObjectQuery that has a GeoWithinFilterBean creates a new DataObjectQuery exactly the same as the original

Actual Behavior:
Running copyObject loses the coordinates of the filter bean and turns them into empty objects
We’ve been using ObjectUtils#copyObject as a workaround

Reproducible Example with Node

const {
  DataObjectQueries,
  Polygon,
  LinearRing,
} = require('@leaf-framework/core');

const query = DataObjectQueries.dataObjectQuery().addFilters(
  DataObjectQueries.geoWithin(
    'geometryField',
    Polygon.of(
      LinearRing.of([
        [10, 10],
        [10, 20],
        [10, 10],
      ])
    )
  )
);

console.log(JSON.stringify(query, null, 4));

const queryCopy = query.copyObject();

console.log(JSON.stringify(queryCopy, null, 4));

Original Query:

{
    "filters": {
        "geometryField": [
            {
                "propertyIdentifier": "geometryField",
                "objectType": "GeoWithinFilterBean",
                "negated": false,
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        [
                            10,
                            10
                        ],
                        [
                            10,
                            20
                        ],
                        [
                            10,
                            10
                        ]
                    ]
                }
            }
        ]
    },
    "propertyIdentifier": "",
    "name": "<Unnamed Query>",
    "version": 0,
    "systemPropertiesRule": "ALL",
    "nonSystemPropertiesRule": "ALL",
    "systemProps": [],
    "nonSystemProps": [],
    "sortingSpec": {
        "directives": []
    }
}

Query Copy:

{
    "filters": {
        "geometryField": [
            {
                "propertyIdentifier": "geometryField",
                "objectType": "GeoWithinFilterBean",
                "negated": false,
                "geometry": {
                    "type": "Polygon",
                    "coordinates": [
                        {},
                        {},
                        {}
                    ]
                }
            }
        ]
    },
    "propertyIdentifier": "",
    "name": "<Unnamed Query>",
    "version": 0,
    "systemPropertiesRule": "ALL",
    "nonSystemPropertiesRule": "ALL",
    "systemProps": [],
    "nonSystemProps": [],
    "sortingSpec": {
        "directives": []
    }
}

Good morning Andrew :wave:

This is a known issue that we have a PR for up right now. Here is a related discourse thread. We’ll have a patch out by the end of the day. I’ll post here when it is available for 3.4

1 Like

3.4.3 is now available and has the fix for this

1 Like

Thank you!