Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .grype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ ignore:
# Remove this entry as soon as a patched braces is published and picked up by the lockfiles.
- vulnerability: GHSA-vfj7-8cjw-p6xm

# source-map-js 1.2.1 (GHSA-68fv-2mgg-jv7q, High, published 2026-09-18): event-loop DoS through
# indexed source-map section offsets in untrusted source maps. Reached only through postcss and
# sass inside the Angular CLI build (ui/), which parses our own sources at build time; nothing of
# it is deployed. The fix, 1.2.2, exists (published 2026-09-30) but the repo's .npmrc
# (min-release-age=7) quarantines it until 2026-10-07. Accepted until then — bump and remove this
# entry per #348.
- vulnerability: GHSA-68fv-2mgg-jv7q

# Registry configuration (if needed for private registries)
# registry:
# auth:
Expand Down
10 changes: 10 additions & 0 deletions schemas/ForestrySource/v1.1.0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ Normative reference: _EUDR Information System — Operator API Reference_, DG EN

The API describes the percentage as an estimate or deviation, so rendering uses neutral wording and does not add an automatic `±` sign.

## Geometry (harvest units)

Normative reference for this section: the EUDR Information System's _GeoJSON description_ and _validation rules_ (Operator API Reference v1.2). Applied in place in v1.1.0 (material-identity/schemas#327, #336):

- `Feature.geometry` accepts `Point`, `Polygon`, `MultiPolygon` and `GeometryCollection`; `MultiPolygon` is also accepted as a `GeometryCollection` member. GIS exports of tenures and cutting permits routinely produce `MultiPolygon`.
- Every linear ring has at least 4 positions (RFC 7946 §3.1.6). Ring closure (first position equal to the last) is required by RFC 7946 and by TRACES but cannot be expressed in JSON Schema; it is not enforced here.
- A `Point` is accepted by TRACES only for plots of at most 4 ha. A `Feature` whose geometry is a `Point` therefore requires `properties.Area` in hectares, between 0.0001 and 4. Larger plots are described as `Polygon` or `MultiPolygon`. The rule applies to the feature's own geometry, not to points inside a `GeometryCollection`.
- `properties.ProducerCountry` stays optional in v1.1.0 for backwards compatibility with published certificates. The EUDR Information System requires it per feature on upload, and the EU-minimum families (ForestrySourceEU, ForestryOutputEU) require it in the schema; the platform UI enforces it for v1.1.0.
- The geometry definitions (`Coordinates`, `PolygonCoordinates`, `Point`, `Polygon`, `MultiPolygon`, `GeometryCollection`, `Feature`, `Location`) are one shared block. `test/shared/forestry-geometry-block.json` holds the canonical text and `test/forestry-source-v1.1.spec.js` asserts that this schema matches it; the EU families join that assertion when they are published.

Regenerate the reference PDFs with:

```sh
Expand Down
64 changes: 62 additions & 2 deletions schemas/ForestrySource/v1.1.0/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,13 @@
},
"PolygonCoordinates": {
"type": "array",
"description": "Array of linear rings (RFC 7946 §3.1.6): the first ring is the exterior boundary, any further rings are holes. Each ring has at least 4 positions and must be closed (first position equal to the last); closure is not enforced by this schema.",
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/Coordinates"
},
"minItems": 3
"minItems": 4
},
"minItems": 1
},
Expand Down Expand Up @@ -338,6 +339,26 @@
},
"required": ["type", "coordinates"]
},
"MultiPolygon": {
"type": "object",
"description": "A MultiPolygon geometry (RFC 7946 §3.1.7): one plot made of several polygons, as GIS exports of tenures and cutting permits commonly produce.",
"properties": {
"type": {
"type": "string",
"enum": ["MultiPolygon"]
},
"coordinates": {
"type": "array",
"description": "One PolygonCoordinates entry per member polygon.",
"items": {
"$ref": "#/definitions/PolygonCoordinates"
},
"minItems": 1
}
},
"required": ["type", "coordinates"],
"additionalProperties": false
},
"GeometryCollection": {
"type": "object",
"description": "A collection of geometry objects",
Expand All @@ -355,6 +376,9 @@
},
{
"$ref": "#/definitions/Polygon"
},
{
"$ref": "#/definitions/MultiPolygon"
}
]
},
Expand Down Expand Up @@ -386,6 +410,7 @@
},
"Area": {
"type": "number",
"description": "Plot area in hectares. Required when the geometry is a Point: the EUDR Information System accepts a Point only for plots of at most 4 ha (minimum 0.0001 ha); larger plots must be described by a Polygon or MultiPolygon.",
"minimum": 0
},
"Name": {
Expand All @@ -401,13 +426,48 @@
{
"$ref": "#/definitions/Polygon"
},
{
"$ref": "#/definitions/MultiPolygon"
},
{
"$ref": "#/definitions/GeometryCollection"
}
]
}
},
"required": ["type", "geometry"]
"required": ["type", "geometry"],
"if": {
"type": "object",
"properties": {
"geometry": {
"type": "object",
"properties": {
"type": {
"const": "Point"
}
},
"required": ["type"]
}
},
"required": ["geometry"]
},
"then": {
"type": "object",
"properties": {
"properties": {
"type": "object",
"properties": {
"Area": {
"type": "number",
"minimum": 0.0001,
"maximum": 4
}
},
"required": ["Area"]
}
},
"required": ["properties"]
}
},
"Location": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,48 @@ void requiresAtLeastOneMeasurement() throws Exception {
assertInvalid(withMeasurements("{}"));
}

private static final String RING =
"[[10.0,50.0],[10.02,50.0],[10.02,50.02],[10.0,50.02],[10.0,50.0]]";

@Test
void acceptsMultiPolygonAsFeatureGeometryAndAsCollectionMember() throws Exception {
assertValid(withFeature("{\"type\":\"MultiPolygon\",\"coordinates\":[[" + RING + "],[" + RING + "]]}",
"{\"Name\":\"Plot\"}"));
assertValid(withFeature(
"{\"type\":\"GeometryCollection\",\"geometries\":[{\"type\":\"Point\",\"coordinates\":[10.0,50.0]},"
+ "{\"type\":\"MultiPolygon\",\"coordinates\":[[" + RING + "]]}]}",
"{\"Name\":\"Plot\"}"));
assertInvalid(withFeature("{\"type\":\"MultiPolygon\",\"coordinates\":[]}", "{\"Name\":\"Plot\"}"));
}

@Test
void requiresAtLeastFourPositionsPerRing() throws Exception {
String threePositions = "[[10.0,50.0],[10.02,50.0],[10.0,50.0]]";
assertInvalid(withFeature("{\"type\":\"Polygon\",\"coordinates\":[" + threePositions + "]}",
"{\"Name\":\"Plot\"}"));
assertInvalid(withFeature("{\"type\":\"MultiPolygon\",\"coordinates\":[[" + threePositions + "]]}",
"{\"Name\":\"Plot\"}"));
}

@Test
void requiresAreaOfAtMostFourHectaresForPointPlots() throws Exception {
String point = "{\"type\":\"Point\",\"coordinates\":[10.0,50.0]}";
assertValid(withFeature(point, "{\"Name\":\"Plot\",\"Area\":3.5}"));
assertValid(withFeature(point, "{\"Name\":\"Plot\",\"Area\":4}"));
assertInvalid(withFeature(point, "{\"Name\":\"Plot\"}"));
assertInvalid(withFeature(point, "{\"Name\":\"Plot\",\"Area\":0}"));
assertInvalid(withFeature(point, "{\"Name\":\"Plot\",\"Area\":4.5}"));
assertValid(withFeature("{\"type\":\"Polygon\",\"coordinates\":[" + RING + "]}", "{\"Name\":\"Plot\"}"));
}

private static JsonNode withFeature(String geometryJson, String propertiesJson) throws Exception {
JsonNode certificate = baseCertificate.deepCopy();
ObjectNode feature = (ObjectNode) certificate.at("/DigitalMaterialPassport/HarvestUnits/0/features/0");
feature.set("geometry", OBJECT_MAPPER.readTree(geometryJson));
feature.set("properties", OBJECT_MAPPER.readTree(propertiesJson));
return certificate;
}

private static JsonNode withMeasurements(String measurementsJson) throws Exception {
JsonNode certificate = baseCertificate.deepCopy();
ObjectNode species = (ObjectNode) certificate.at("/DigitalMaterialPassport/Products/0/ListOfSpecies/0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{
"type": "Feature",
"properties": {
"Name": "Harvest Unit 1"
"Name": "Harvest Unit 1",
"Area": 3.5
},
"geometry": {
"type": "Point",
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@
"Name": "Harvest Unit 1"
},
"geometry": {
"type": "Point",
"coordinates": [-125.3320128, 50.123282]
"type": "Polygon",
"coordinates": [
[
[-125.3357928, 50.120852],
[-125.3282328, 50.120852],
[-125.3282328, 50.125712],
[-125.3357928, 50.125712],
[-125.3357928, 50.120852]
]
]
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@
"Name": "Harvest Unit 1"
},
"geometry": {
"type": "Point",
"coordinates": [-125.3320128, 50.123282]
"type": "Polygon",
"coordinates": [
[
[-125.3357928, 50.120852],
[-125.3282328, 50.120852],
[-125.3282328, 50.125712],
[-125.3357928, 50.125712],
[-125.3357928, 50.120852]
]
]
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,29 @@
{
"type": "Point",
"coordinates": [117.550, 0.750]
},
{
"type": "MultiPolygon",
"coordinates": [
[
[
[117.620, 0.700],
[117.660, 0.700],
[117.660, 0.740],
[117.620, 0.740],
[117.620, 0.700]
]
],
[
[
[117.620, 0.760],
[117.650, 0.760],
[117.650, 0.800],
[117.620, 0.800],
[117.620, 0.760]
]
]
]
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,27 @@
"Name": "Mixed Species Production Unit"
},
"geometry": {
"type": "Point",
"coordinates": [-123.0351, 44.9778]
"type": "MultiPolygon",
"coordinates": [
[
[
[-123.0461, 44.97],
[-123.0241, 44.97],
[-123.0241, 44.9856],
[-123.0461, 44.9856],
[-123.0461, 44.97]
]
],
[
[
[-123.0129, 44.9723],
[-122.9973, 44.9723],
[-122.9973, 44.9833],
[-123.0129, 44.9833],
[-123.0129, 44.9723]
]
]
]
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{
"type": "Feature",
"properties": {
"Name": "Harvest Unit 1"
"Name": "Harvest Unit 1",
"Area": 2.75
},
"geometry": {
"type": "Point",
Expand Down
Binary file not shown.
Loading
Loading