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": []
}
}
