Skip to content

parseControlStreamSchemaResponse() does not accept paramsSchema — silent data loss on older OSH servers #140

@Sam-Bolling

Description

@Sam-Bolling

Summary

parseControlStreamSchemaResponse() in src/ogc-api/csapi/formats/schema-response.ts only looks for parametersSchema in the server response object. OpenSensorHub servers built from older source commits use paramsSchema as the JSON property name instead. When parsing a response from such a server, the function silently returns parametersSchema: undefined — no error is thrown, but the schema data is lost.

Discovery

Discovered during Oracle Cloud smoke testing via javap -c -p bytecode decompilation of compiled OSH server JARs. The compiled CommandStreamSchemaBindingJson.class contains the string literal "paramsSchema" (not "parametersSchema"), and CommandBindingJson.class contains "params" (not "parameters").

Affected Code

Upstream PR (camptocamp#136):

// schema-response.ts line ~160
const rawParametersSchema = obj.parametersSchema;
//                              ^^^^^^^^^^^^^^^^ — only this name

Fix (already applied in ogc-csapi-explorer):

// Accept both "parametersSchema" (newer OSH / OGC spec) and "paramsSchema" (older OSH builds)
const rawParametersSchema = obj.parametersSchema ?? obj.paramsSchema;

Cross-Server Evidence

Server Build Property Name
Oracle Cloud OSH (129.80.248.53) Built from source (osh-core@e74e12e2) paramsSchema
DigitalOcean OSH (45.55.99.236) Pre-built distribution parametersSchema
52°North CSA Demo Different implementation parametersSchema

Impact

  • Silent data loss: consumers receive undefined instead of the actual schema
  • Affects any OSH server running JARs built before the property was renamed
  • The parseDatastreamSchemaResponse() function is NOT affected (its property names are consistent across builds)

Proposed Fix

  1. Add ?? obj.paramsSchema fallback in parseControlStreamSchemaResponse()
  2. Add a unit test with a fixture using paramsSchema
  3. Add JSDoc noting the dual-name pattern

Findings Report

Full findings report with bytecode evidence, cross-server comparison, and analysis:
docs/research/phase-6/findings/osh-server-property-name-divergence.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions