Skip to content

feat: enforce related-link target roles and align docs/examples#40

Merged
emmanuelmathot merged 6 commits into
mainfrom
better-roles
May 20, 2026
Merged

feat: enforce related-link target roles and align docs/examples#40
emmanuelmathot merged 6 commits into
mainfrom
better-roles

Conversation

@emmanuelmathot

Copy link
Copy Markdown
Collaborator

Summary

  • implement issue Define roles on related links for event/hazard/impact item relationships #39 by defining and enforcing role semantics for rel="related" links
  • update model/source documentation to clarify that related links must carry exactly one target role: event, hazard, or impact
  • align examples with the new convention and fix role inconsistencies
  • extend schema validation for related links and tighten role cardinality
  • include source-doc markdown structure cleanups in IDU/PDC docs

Changes

  • updated extension spec guidance in README
  • added related-link validation logic in json-schema/schema.json
  • updated model/source docs (GDACS, USGS, IDU, PDC, and source index)
  • normalized related-link roles in affected example items

Validation

  • checked repository diagnostics on edited docs/files
  • verified branch clean and synchronized before opening PR

Closes #39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements issue #39 by formalizing role semantics for rel="related" links between event/hazard/impact items, and aligning schema/docs/examples to that convention.

Changes:

  • Adds JSON Schema validation to require exactly one target role (event/hazard/impact) on rel="related" links.
  • Updates documentation across multiple source pages and the main README to describe the new related-link role convention.
  • Normalizes existing examples to remove multi-role related links (e.g., dropping source/reference from link roles).

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
json-schema/schema.json Adds links validation and new definitions to enforce typed related links.
README.md Updates roles guidance and adds related link semantics to docs.
docs/model/README.md Documents cross-item typing via rel="related" link roles.
docs/model/sources/README.md Adds a “Role Conventions” section clarifying item vs link role expectations.
docs/model/sources/USGS/README.md Updates mappings to reflect typed related links; adds corr_id/guid references.
docs/model/sources/GDACS/README.md Updates mappings to include typed related links and corr_id/guid references.
docs/model/sources/PDC/README.md Reorders/clarifies item role examples for consistency.
docs/model/sources/IDU/README.md Cleans up markdown structure and clarifies role ordering.
examples/* Updates related link roles in multiple example items to the new one-role convention.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/model/sources/USGS/README.md Outdated
Comment thread docs/model/sources/GDACS/README.md Outdated
Comment thread docs/model/sources/GDACS/README.md Outdated
Comment thread json-schema/schema.json
Comment on lines +280 to +284
"not": {
"type": "object",
"required": [
"rel"
],

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non_related_link currently matches any object that is not {rel: "related"}, including objects with no rel at all. Because this is used under links.items.anyOf, malformed link entries (missing rel/href) will validate as non_related_link, weakening the intended validation. Consider defining a base link schema that requires at least rel and href, then composing it with the not rel=related constraint for the non-related branch.

Copilot uses AI. Check for mistakes.
Comment thread json-schema/schema.json Outdated
Comment on lines +295 to +299
"type": "object",
"required": [
"rel",
"roles"
],

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typed_related_link requires rel and roles but does not require href (or other core Link Object fields). That means a rel="related" link with the right role but no target URI would still pass this schema. If this schema is meant to validate related-item relationships, require href (and optionally type) here, or compose this with a shared base link definition.

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
Comment on lines 74 to 79
| Field Name | Type | Description |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| roles | [string] | Semantic classification for the linked entity. For `rel="related"` links between Monty items, use `event`, `hazard` or `impact` |
| occ_type | string | The type of the occurrence. It can be one of the following values: `known`, `potential` |
| occ_prob | string | It is a qualitative assessment of the likelihood of the linked hazard occurring with the main hazard (e.g. `high`) |
| occ_probdef | uri | It is a link to the definition of the probability for the hazard relationship |

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Link Attributes table lists roles as type [string], but roles is an array of strings (and the rest of the doc uses escaped \[string] for arrays). Update the type and description to reflect an array, consistent with STAC common metadata and the JSON Schema enforcement.

Suggested change
| Field Name | Type | Description |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------ |
| roles | [string] | Semantic classification for the linked entity. For `rel="related"` links between Monty items, use `event`, `hazard` or `impact` |
| occ_type | string | The type of the occurrence. It can be one of the following values: `known`, `potential` |
| occ_prob | string | It is a qualitative assessment of the likelihood of the linked hazard occurring with the main hazard (e.g. `high`) |
| occ_probdef | uri | It is a link to the definition of the probability for the hazard relationship |
| Field Name | Type | Description |
| ----------- | -------- | ------------------------------------------------------------------------------------------------------------------ |
| roles | \[string] | Semantic classification for the linked entity as an array of strings. For `rel="related"` links between Monty items, use `event`, `hazard` or `impact` |
| occ_type | string | The type of the occurrence. It can be one of the following values: `known`, `potential` |
| occ_prob | string | It is a qualitative assessment of the likelihood of the linked hazard occurring with the main hazard (e.g. `high`) |
| occ_probdef | uri | It is a link to the definition of the probability for the hazard relationship |

Copilot uses AI. Check for mistakes.
Comment thread docs/model/sources/USGS/README.md Outdated
Comment on lines +113 to +114
| [`related` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) | properties.url + "/map" | Link to the USGS interactive map for this event (external resource, not a STAC item relationship) |
| [`related` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) | properties.url + "/region" | Link to the USGS regional information for this event (external resource, not a STAC item relationship) |

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This markdown uses table-row syntax for the properties.url + "/map" and .../region entries but there is no header/separator for a 3-column table in this section, so these lines will render incorrectly. Convert these to a bullet list, or add a proper table header that matches the row shape.

Suggested change
| [`related` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) | properties.url + "/map" | Link to the USGS interactive map for this event (external resource, not a STAC item relationship) |
| [`related` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) | properties.url + "/region" | Link to the USGS regional information for this event (external resource, not a STAC item relationship) |
- [`related` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) with `properties.url + "/map"`: Link to the USGS interactive map for this event (external resource, not a STAC item relationship)
- [`related` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) with `properties.url + "/region"`: Link to the USGS regional information for this event (external resource, not a STAC item relationship)

Copilot uses AI. Check for mistakes.
Comment thread docs/model/sources/USGS/README.md Outdated
| [`via` link](https://github.com/radiantearth/stac-spec/blob/master/commons/assets.md) | properties.url | Link to the USGS event details page |
| `related` link in [links] | Reference event item | Link to reference event item with `roles: ["event"]` |
| [monty:corr_id](https://ifrcgo.org/monty-stac-extension/v1.1.1/schema.json#monty:corr_id) | Generated | Generated following the [event correlation](../../correlation_identifier.md) convention |
| [monty:guid](https://ifrcgo.org/monty-stac-extension/v1.1.1/schema.json#monty:guid) | Generated | Generated following the [guid string](../../global_identififer.md) convention |

Copilot AI Mar 30, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The relative link ../../global_identififer.md appears to be broken (no such file in docs/model/). Either add the referenced document or update the link to the correct existing GUID documentation path.

Suggested change
| [monty:guid](https://ifrcgo.org/monty-stac-extension/v1.1.1/schema.json#monty:guid) | Generated | Generated following the [guid string](../../global_identififer.md) convention |
| [monty:guid](https://ifrcgo.org/monty-stac-extension/v1.1.1/schema.json#monty:guid) | Generated | Generated following the [guid string](../../global_identifier.md) convention |

Copilot uses AI. Check for mistakes.
emmanuelmathot added a commit that referenced this pull request May 20, 2026
- Tighten non_related_link and typed_related_link to require href via shared base_link definition
- Convert USGS related-link table fragments into bullet list (no orphan rows)
- Fix global_identifier.md link typo in USGS docs
- Update README Link Attributes table: roles type as escaped array, refresh column widths
emmanuelmathot and others added 6 commits May 20, 2026 16:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
- Tighten non_related_link and typed_related_link to require href via shared base_link definition
- Convert USGS related-link table fragments into bullet list (no orphan rows)
- Fix global_identifier.md link typo in USGS docs
- Update README Link Attributes table: roles type as escaped array, refresh column widths
@emmanuelmathot emmanuelmathot merged commit b55afb5 into main May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define roles on related links for event/hazard/impact item relationships

2 participants