Repository navigation
Description
Task
Add optional @link-derived fields and a shared CSAPIResourceRef type to the Part 1 GeoJSON interfaces (System, Deployment, SamplingFeature) in model.ts so consumers have typed access to structural associations defined by OGC 23-001 §16.
Finding Reference: Gap 1 from CS API @link Property Gap Analysis
Severity: Moderate
Category: Design gap
Ownership: Ours
Problem Statement
The OGC CS API JSON encoding (OGC 23-001 §16) defines inline @link properties on Part 1 GeoJSON resources to encode structural associations between resources:
System ──systemKind@link──→ Procedure
Deployment ──platform@link──→ System (platform)
Deployment ──deployedSystems@link──→ [System, System, ...]
SamplingFeature ──sampledFeature@link──→ Feature
The four Part 1 GeoJSON resource interfaces in model.ts do not include any @link fields. After extractCSAPIFeature() parses server JSON, all @link data is silently discarded because:
- The TypeScript interfaces have no
@linkfields to define the shape - The parser uses an allowlist extraction pattern — only named interface properties survive
Evidence:
The SamplingFeature JSDoc (model.ts L412) explicitly states:
"The
sampledFeature@linklink relation is also required."
…but the interface below it omits the field entirely.
Server JSON that gets lost:
{
"id": "of45kp7s5ims",
"type": "Feature",
"properties": {
"featureType": "http://www.w3.org/ns/sosa/Platform",
"uid": "urn:osh:sensor:odas:buoy:46042",
"name": "ODAS Station 46042 — Monterey",
"systemKind@link": {
"href": "http://45.55.99.236:8080/sensorhub/api/procedures/of45l6iqgims",
"uid": "urn:osh:sensor:odas:procedure:buoy-platform",
"rt": "http://www.w3.org/ns/sosa/Procedure",
"title": "ODAS Standard Buoy Platform"
}
}
}After parsing, systemKind@link is gone. The parsed System object provides no path to the procedure it implements.
Impact: Consumers cannot type-safely read @link fields from parsed resources. The ogc-csapi-explorer demo app had to implement a tryLinkFallback() workaround (commit ad06b52) that bypasses the library's typed models and reads @link fields from raw JSON.
Findings Report
Files to Create or Modify
| File | Action | Est. Lines | Purpose |
|---|---|---|---|
src/ogc-api/csapi/model.ts |
Modify | ~+12 | Add CSAPIResourceRef interface + optional @link-derived fields to 3 interfaces |
src/index.ts |
Modify | ~+1 | Export CSAPIResourceRef type |
Proposed Fix
Add a shared CSAPIResourceRef type and optional @link-derived fields to 3 Part 1 interfaces:
New Type
/** Parsed form of a CS API `@link` inline property. */
export interface CSAPIResourceRef {
/** URL of the referenced resource. */
href: string;
/** Globally unique identifier of the referenced resource. */
uid?: string;
/** Human-readable title. */
title?: string;
/** Resource type URI. */
rt?: string;
}Interface Changes
| Interface | New Field | Type | Spec Reference |
|---|---|---|---|
System |
systemKindLink? |
CSAPIResourceRef |
OGC 23-001 §8.3 Table 8 |
Deployment |
platformLink? |
CSAPIResourceRef |
OGC 23-001 §8.5 Table 10 |
Deployment |
deployedSystemsLink? |
CSAPIResourceRef[] |
OGC 23-001 §8.5 Table 10 |
SamplingFeature |
sampledFeatureLink? |
CSAPIResourceRef |
OGC 23-001 §8.9 Table 14 |
Design notes:
- All fields are optional (
?) — servers aren't required to include@linkproperties in every response context - camelCase naming without
@sigil (e.g.,systemKindLinknotsystemKind@link) for TypeScript ergonomics deployedSystemsLinkisCSAPIResourceRef[](array) because deployments can have multiple systemsProcedurehas no spec-defined@linkproperties — no change needed- Parser changes to populate these fields are tracked separately in Part 1
extractCSAPIFeature()silently drops all@linkproperties during parsing #109
Scope — What NOT to Touch
- ❌ Do NOT modify
src/ogc-api/csapi/formats/geojson.ts— parser changes belong to Part 1extractCSAPIFeature()silently drops all@linkproperties during parsing #109 - ❌ Do NOT add
@linkresolution utility functions — those belong to DEFERRED — No@link/@idresolution utilities for cross-resource reference following #110 - ❌ Do NOT modify Part 2 interfaces — Part 2
@linkfields are a separate concern - ❌ Do NOT modify
ResourceLink/OgcApiDocumentLink— different type for HATEOAS links - ❌ Do NOT modify the
Procedureinterface — no spec-defined@linkproperties for Procedures - ❌ Do NOT modify files outside the "Files to Create or Modify" table above
- ❌ Do NOT refactor existing code unless required to complete this task
Acceptance Criteria
-
CSAPIResourceRefinterface exists inmodel.tswithhref,uid?,title?,rt?fields -
System.propertiesincludes optionalsystemKindLink?: CSAPIResourceRef -
Deployment.propertiesincludes optionalplatformLink?: CSAPIResourceRefanddeployedSystemsLink?: CSAPIResourceRef[] -
SamplingFeature.propertiesincludes optionalsampledFeatureLink?: CSAPIResourceRef -
CSAPIResourceRefis exported fromsrc/index.ts - All new fields have JSDoc documentation with
@seelinks to OGC spec sections - Existing tests still pass (
npm test) - No TypeScript errors
- No lint errors
Dependencies
Blocked by: Nothing
Blocks: #109 — Part 1 extractCSAPIFeature() parser must extract @link properties (needs interface fields first)
Operational Constraints
⚠️ MANDATORY: Before starting work on this issue, reviewdocs/governance/AI_OPERATIONAL_CONSTRAINTS.md.
Key constraints:
- Precedence: OGC specifications → AI Collaboration Agreement → This issue description → Existing code → Conversational context
- No scope expansion: Add the interface fields, nothing more
- Minimal diffs: Prefer the smallest change that satisfies the acceptance criteria
- No refactoring: Do not rename, restructure, or "improve" code outside this issue's scope
References
| # | Document | What It Provides |
|---|---|---|
| 1 | Issue #108 Findings Report | Full source code review, risk assessment, and recommendation |
| 2 | CS API @link Property Gap Analysis |
Full audit of all @link gaps across the library |
| 3 | AI Operational Constraints | Mandatory operational behavior for AI collaboration |
| 4 | Issue #103 — Part 2 cross-reference fields | Precedent: Part 2 @id fields (same pattern, already resolved) |
| 5 | ogc-csapi-explorer tryLinkFallback() (ad06b52) |
Real-world workaround demonstrating the gap |
| 6 | src/ogc-api/csapi/model.ts |
Source file to modify |
| 7 | src/index.ts |
Public exports file |
Specification References
| # | Document | Use |
|---|---|---|
| 1 | OGC 23-001 §8.3 (Table 8) | System resource model — procedure association (Conditional) |
| 2 | OGC 23-001 §8.5 (Table 10) | Deployment resource model — platform (Optional), deployedSystems (Required) |
| 3 | OGC 23-001 §8.9 (Table 14) | SamplingFeature resource model — sampledFeature (Required) |
| 4 | OGC 23-001 §16 | JSON encoding for Part 1 GeoJSON resources — @link inline property convention |
Activity
docs: add @link property gap analysis report for upstream CSAPI libra…
docs: add findings report for Issue #108 — Part 1 @link properties
docs: add findings report for Issue #109 — extractCSAPIFeature() drops …
feat: extract @link properties in extractCSAPIFeature() (#109)\n\nAdd…
docs: add findings report for Issue #110 — @link resolution utilities
docs: add Phase 5.5 code review (Issues #99-#110 post-smoke-test)
Add CSAPIResourceRef type and @link fields to Part 1 interfaces (Fixes …
merge: sync with upstream ogc-client-CSAPI_2 (Phase 5.5/5.6)
docs: clarify #103, #108, #109 are resolved in review report