Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix array attribute examples #1325

Merged
merged 3 commits into from
Aug 8, 2024
Merged

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented Aug 8, 2024

Examples of array attributes are ambiguous, this PR disambiguates them.

E.g. it's unclear what this example means:

type: string[]
examples: [foo, bar]

Should it result in 2 examples ([foo] and [bar]) or one example ([foo, bar])?

Thanks to @jerbly for the context on how it should be interpreted:

The syntax document in build-tools does call out specifically: "A single example value for an array of strings attribute" examples: ['first element of first array', 'second element of first array'] as valid.

But it goes against yaml array syntax - the above example is equivalent to

type: string[]
examples: 
  - foo # this should be an array, not a string
  - bar # this should be an array, not a string

which then fails type checks being introduced in open-telemetry/weaver#300.

The proper syntax should be

type: string[]
examples: 
  - [foo] 
  - [foo, bar]

Merge requirement checklist

@lmolkova lmolkova added the Skip Changelog Label to skip the changelog check label Aug 8, 2024
@lmolkova lmolkova requested review from a team August 8, 2024 03:11
@lmolkova
Copy link
Contributor Author

lmolkova commented Aug 8, 2024

TIL it's possible to write

type: string[]
examples: 
  -
    - foo
  - 
    - foo
    - bar

🙈

@jsuereth jsuereth merged commit 231528e into open-telemetry:main Aug 8, 2024
13 checks passed
ezimuel pushed a commit to ezimuel/semantic-conventions that referenced this pull request Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog Label to skip the changelog check
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants