RuterNo / adt-doc

Documentation intended for PTOs who need to connect to Ruters digitale plattform
Apache License 2.0
4 stars 0 forks source link

ADT 3.0 - Update telemetry schema for compatibility with statically typed language code generators #189

Closed kalosar closed 9 months ago

kalosar commented 9 months ago

Issue Summary

Static type constraints in languages like Java present challenges with the multi-typed value field in the Telemetry JSON schema. The schema's current state, which is aligned with JSON Schema Draft-07, is incompatible with Java code generators that expect a singular type for any given field.

Problem Description

The value field within the payloads array is intended to support multiple types (number, boolean, string) to allow for versatile telemetry data representation. This multi-type pattern is not natively supported by Java code generation tools, which often results in faulty generation or complete failure due to the static typing requirement.

In Kotlin, similar issues are gracefully managed using sealed classes. However, Java does not have an equivalent feature set, leading to code generation issues.

Proposed Change

To address the limitation, we propose the following adjustments to the schema:

Expected Benefits

Adjusted Schema Snippet


"value": {
  "description": "The value is expected to be a number, boolean, or string."
}