Fix false-positive geometry metadata violations on place-less features - #800
Merged
Merged
Conversation
The `/req/{prisms,polyhedra,circular-arcs}/metadata` rules detect whether a
JSON-FG document contains a geometry of the relevant type by matching
`place.type` against an enum. The `if` subschema only used JSON Schema
`properties`, which is vacuously satisfied when the property is absent.
As a result, a FeatureCollection containing any feature without a `place`
member (or a `place` without a `type`) matched the `features.contains`
subschema, which made the rule demand the conformance-class URI even though
no geometry of that type is present — a false positive.
This is what happens for the OGC workshop document
`3D_polyhedron_dom_FG.json`: its first feature has no `place` member, so the
collection was wrongly flagged with `/req/prisms/metadata` (and would also be
flagged for polyhedra/circular-arcs) despite containing no Prism geometries.
Require `place` (as an object) and `place.type` in the matched subschema so a
feature only counts when it actually carries a geometry of the target type.
Adds regression tests covering a FeatureCollection with a place-less feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
For
3D_polyhedron_dom_FG.jsonthe checker reports/req/prisms/metadata, even though the document contains no (Multi)Prism geometries.Root cause
The
/req/{prisms,polyhedra,circular-arcs}/metadatarules decide whether a document contains a geometry of the relevant type by matchingplace.typeagainst an enum. Theifsubschema only used JSON Schemaproperties, which is vacuously true when the property is absent.So in the
FeatureCollectionbranch,features.containsmatched any feature that simply lacked aplace(or had aplacewith notype). The workshop document's first feature has noplacemember, socontainswas satisfied → the rule demanded the conformance-class URI → false positive. The single-Featurebranch had the same latent gap.This affects all three geometry-type metadata rules; the same place-less feature would also falsely trip
polyhedraandcircular-arcs.Fix
Require
place(typed asobject) andplace.typein the matched subschema, so a feature only counts when it actually carries a geometry of the target type.types-schemasalready usedrequiredin itscontainsand was unaffected.Tests
FeatureCollectionwith a place-less feature and no target geometry must not raise the metadata violation.json-fgsuite passes (107 tests); lint clean.