Skip to content

Commit

Permalink
[configuration] Specify YAML schema that configuration files should f…
Browse files Browse the repository at this point in the history
…ollow (#3973)

Fixes #3962

## Changes

Specifies the YAML schema to follow. A schema is a set of YAML tags
(i.e. types) and a way to assign types.

YAML 1.2 recommends the 'Core schema': the types are those of JSON.
Scalars are resolved as one would expect, see
[here](https://yaml.org/spec/1.2.2/#103-core-schema) for the details.

One important difference with the way that YAML 1.1 used to work is that
integer scalars starting with a `0` are interpreted as being written in
decimal notation; e.g. `0123` parses to the integer 123 instead of the
integer 83 (you can still use octal notation in YAML 1.2 by using
`0o123`). Some YAML parsers deviate from the core schema in how this
works, for example, both of the more commonly used YAML parsing
libraries in Golang parse `0123` as 83
([go-yaml/yaml](https://github.com/go-yaml/yaml?tab=readme-ov-file#compatibility)
and
[goccy/go-yaml](https://github.com/goccy/go-yaml/blob/4653a1bb5c0047bb37280ac341e2f091cb44352f/ast/ast.go#L326)).
**This may make it a bit difficult to strictly follow this requirement
in some languages**.

For non-trivial changes, follow the [change proposal
process](https://github.com/open-telemetry/opentelemetry-specification/blob/main/CONTRIBUTING.md#proposing-a-change).

* [x] Related issues #3962, part of #3963

---------

Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: jack-berg <34418638+jack-berg@users.noreply.github.com>
  • Loading branch information
3 people committed May 7, 2024
1 parent 8218145 commit 7627644
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ release.
([#4002](https://github.com/open-telemetry/opentelemetry-specification/pull/4002))
- Add end to end examples for file configuration
([#4018](https://github.com/open-telemetry/opentelemetry-specification/pull/4018))
- Clarify the schema for YAML configuration files
([#3973](https://github.com/open-telemetry/opentelemetry-specification/pull/3973))

### Common

Expand Down
2 changes: 2 additions & 0 deletions specification/configuration/file-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ Configuration files SHOULD use one the following serialization formats:
[YAML](https://yaml.org/spec/1.2.2/) configuration files SHOULD follow YAML spec
revision >= 1.2.

YAML configuration files SHOULD be parsed using [v1.2 YAML core schema](https://yaml.org/spec/1.2.2/#103-core-schema).

YAML configuration files MUST use file extensions `.yaml` or `.yml`.

### Environment variable substitution
Expand Down

0 comments on commit 7627644

Please sign in to comment.