diff --git a/schema/instrumentation.json b/schema/instrumentation.json index b698ddd4..f529bf03 100644 --- a/schema/instrumentation.json +++ b/schema/instrumentation.json @@ -2,7 +2,9 @@ "$id": "https://opentelemetry.io/otelconfig/instrumentation.json", "$schema": "https://json-schema.org/draft/2020-12/schema", "type": "object", - "additionalProperties": false, + "additionalProperties": { + "$ref": "#/$defs/ExperimentalGeneralInstrumentation" + }, "properties": { "general": { "$ref": "#/$defs/ExperimentalGeneralInstrumentation" @@ -41,11 +43,6 @@ "$ref": "#/$defs/ExperimentalLanguageSpecificInstrumentation" } }, - "patternProperties": { - ".*": { - "$ref": "#/$defs/ExperimentalLanguageSpecificInstrumentation" - } - }, "$defs": { "ExperimentalGeneralInstrumentation": { "type": "object", @@ -128,11 +125,8 @@ }, "ExperimentalLanguageSpecificInstrumentation": { "type": "object", - "additionalProperties": true, - "patternProperties": { - ".*": { - "type": "object" - } + "additionalProperties": { + "type": "object" } } } diff --git a/schema/logger_provider.json b/schema/logger_provider.json index 63cb8e77..9120b1ac 100644 --- a/schema/logger_provider.json +++ b/schema/logger_provider.json @@ -64,7 +64,9 @@ }, "LogRecordExporter": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -80,11 +82,6 @@ "console": { "$ref": "common.json#/$defs/ConsoleExporter" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "LogRecordLimits": { @@ -103,7 +100,9 @@ }, "LogRecordProcessor": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -113,11 +112,6 @@ "simple": { "$ref": "#/$defs/SimpleLogRecordProcessor" } - }, - "patternProperties": { - ".*": { - "type": ["object"] - } } }, "ExperimentalLoggerConfigurator": { diff --git a/schema/meter_provider.json b/schema/meter_provider.json index 602ce384..e6138ea3 100644 --- a/schema/meter_provider.json +++ b/schema/meter_provider.json @@ -126,7 +126,9 @@ }, "PushMetricExporter": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -142,43 +144,32 @@ "console": { "$ref": "common.json#/$defs/ConsoleExporter" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "PullMetricExporter": { "type": ["object"], - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { "prometheus/development": { "$ref": "#/$defs/ExperimentalPrometheusMetricExporter" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "MetricProducer": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { "opencensus": { "$ref": "#/$defs/OpenCensusMetricProducer" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "OpenCensusMetricProducer": { diff --git a/schema/propagator.json b/schema/propagator.json index af1ad122..7283170f 100644 --- a/schema/propagator.json +++ b/schema/propagator.json @@ -16,7 +16,9 @@ "$defs": { "TextMapPropagator": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -38,11 +40,6 @@ "ottrace": { "$ref": "#/$defs/OpenTracingPropagator" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "TraceContextPropagator": { diff --git a/schema/resource.json b/schema/resource.json index ca8add58..9d4420b8 100644 --- a/schema/resource.json +++ b/schema/resource.json @@ -78,7 +78,9 @@ }, "ExperimentalResourceDetector": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -94,11 +96,6 @@ "service": { "$ref": "#/$defs/ExperimentalServiceResourceDetector" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "ExperimentalContainerResourceDetector": { diff --git a/schema/tracer_provider.json b/schema/tracer_provider.json index d2a660c0..d290c7da 100644 --- a/schema/tracer_provider.json +++ b/schema/tracer_provider.json @@ -55,7 +55,9 @@ }, "Sampler": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -74,11 +76,6 @@ "trace_id_ratio_based": { "$ref": "#/$defs/TraceIdRatioBasedSampler" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "AlwaysOffSampler": { @@ -149,7 +146,9 @@ }, "SpanExporter": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -168,11 +167,6 @@ "zipkin": { "$ref": "#/$defs/ZipkinSpanExporter" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "SpanLimits": { @@ -207,7 +201,9 @@ }, "SpanProcessor": { "type": "object", - "additionalProperties": true, + "additionalProperties": { + "type": ["object", "null"] + }, "minProperties": 1, "maxProperties": 1, "properties": { @@ -217,11 +213,6 @@ "simple": { "$ref": "#/$defs/SimpleSpanProcessor" } - }, - "patternProperties": { - ".*": { - "type": ["object", "null"] - } } }, "ZipkinSpanExporter": { diff --git a/schema/type_descriptions.yaml b/schema/type_descriptions.yaml index 42507281..e9ce0192 100644 --- a/schema/type_descriptions.yaml +++ b/schema/type_descriptions.yaml @@ -8,7 +8,7 @@ # propertyB: The propertyB description. # The description for MyType.propertyB # path_patterns: # Array of patterns where this type occurs in the schema. Each key-value in an example configuration file is transformed # - .foo # into its JSON dot-notation location in the file, which is matched against these patterns. Each pattern is turned in a regex, - # after escaping special characters and replacing "*" with ".*". + # after escaping special characters and replacing "*" with ".+". # START OpenTelemetryConfiguration - type: OpenTelemetryConfiguration diff --git a/scripts/generate-descriptions.js b/scripts/generate-descriptions.js index 2564f9fc..f15a43fc 100644 --- a/scripts/generate-descriptions.js +++ b/scripts/generate-descriptions.js @@ -135,7 +135,7 @@ if (outputFile === null) { // Helper functions // Converts an input pattern to a regular expression. -// Converts any "*" to a ".*". +// Converts any "*" to a ".+". // Escapes all other regex special characters. // Prefixes with "^", and adds "$" suffix. function toRegex(pattern) { @@ -143,7 +143,7 @@ function toRegex(pattern) { if (parts.length === 0) parts = [pattern]; const escaped = parts .map(chunk => chunk.replace(/[-[\]{}()*+?.,\\^$|]/g, "\\$&")) - .join("(.*)"); + .join("(.+)"); return "^" + escaped + "$"; }