opentelemetry-configuration icon indicating copy to clipboard operation
opentelemetry-configuration copied to clipboard

Define schema for simple propagator

Open marcalff opened this issue 1 year ago • 2 comments

Currently, propagator.json reads as:

{
    "$id": "https://opentelemetry.io/otelconfig/propagator.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "Propagator",
    "type": "object",
    "minProperties": 1,
    "maxProperties": 1,
    "additionalProperties": true,
    "properties": {
        "composite": {
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    }
}

This defines how a composite proparator is represented, but leaves the definition for the simple propagator open to any interpretation, with additional properties.

All the following can be considered valid [1] per the schema:

propagator:
  tracecontext
propagator:
  this_also:
    is_valid: yes
    is_intented: probably_not
    use: tracecontext

Please add another property for simple, with a type string, and do not allow additionalProperties.

The intended representation should be:

propagator:
  simple: tracecontext

Not well versed in json-schema, but I would expect something like:

{
    "$id": "https://opentelemetry.io/otelconfig/propagator.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "Propagator",
    "type": "object",
    "minProperties": 1,
    "maxProperties": 1,
    "properties": {
        "composite": {
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "simple": {
            "type": "string"
        }
    }
}

[1] From casually reading the schema and writing yaml, I did not try a validator.

marcalff avatar Feb 22 '24 00:02 marcalff