Repository navigation
Use fes:ResourceId in WFS 2.0.0 transaction filters - #17583
Conversation
|
📦 Preview the website for this branch here: https://deploy-preview-17583--ol-site.netlify.app/. |
There was a problem hiding this comment.
Thanks for addressing this, @sobol-sudo. The change looks good. For the test to be less bloated, I'd prefer if you'd address the read side as well and do a clean round-trip test instead.
| const resourceIds = serialized.getElementsByTagNameNS( | ||
| 'http://www.opengis.net/fes/2.0', | ||
| 'ResourceId', | ||
| ); | ||
| assert.lengthOf(resourceIds, 2); | ||
| for (const resourceId of resourceIds) { | ||
| assert.strictEqual(resourceId.getAttribute('rid'), '12345'); | ||
| } | ||
| const xmlString = new XMLSerializer().serializeToString(serialized); | ||
| assert.notInclude(xmlString, 'FeatureId'); | ||
| assert.notInclude(xmlString, 'fid='); |
There was a problem hiding this comment.
The tests would look nicer if you'd fix the read side as well, because then a round trip with a single assertXmlEqual() could replace all these lines.
|
Done — read side is in, and the test is now a single round-trip.
The spec now writes a 2.0.0 transaction, takes the Browser suite is green apart from |
ahocevar
left a comment
There was a problem hiding this comment.
Sorry, my bad about round-trip — not ideal here because of the "Transaction"/"TransactionResponse" asymmetry. I split the test into two, and now I think they are much easier to read.
Thanks, @sobol-sudo
Fixes #16166.
When you write a WFS transaction with
version: '2.0.0', the update and delete bodies come out with<Filter><FeatureId fid="..."/></Filter>. That element is WFS 1.x only — 2.0.0 renamed it toResourceIdwith anridattribute, and moved filters into thefes/2.0namespace. GeoServer rejects the request as an unparsable filter, sowriteTransactiondoesn't really work against a 2.0.0 server.writeOgcFidFilteralready reads the version into a local but never uses it, so this branches on it the same waywritePropertydoes a few lines below when it picks betweenValueReferenceandName. It also switches the namespace lookup fromOGCNS[version]to the existinggetFilterNS(version)helper —ResourceIdonly exists infes/2.0, so renaming the element without that would still produce something GeoServer rejects.getFilterNSis what every other filter-writing function in the file already uses, and for 1.0.0 and 1.1.0 it returns exactly whatOGCNS[version]returned, so nothing changes on those versions.I added a spec next to the existing
ValueReferenceone that writes a 2.0.0 transaction with both an update and a delete, so both call sites are covered, and looks the elements up by namespace rather than by string so the namespace half is actually asserted. It fails on main with noResourceIdelements found. The full browser suite is green at 173 files / 3041 tests, node at 74 / 2217, plus lint and both typechecks.One thing I left alone: the read side has the same gap, since
OGC_FID_PARSERSonly knowsFeatureId, so 2.0.0 TransactionResponse insert results don't parse. Happy to do that separately if you want it.