Skip to content

Add minItems recommendation for array properties#386

Merged
jack-berg merged 8 commits intoopen-telemetry:mainfrom
jack-berg:min-items-guidance
Nov 13, 2025
Merged

Add minItems recommendation for array properties#386
jack-berg merged 8 commits intoopen-telemetry:mainfrom
jack-berg:min-items-guidance

Conversation

@jack-berg
Copy link
Copy Markdown
Member

Don't feel super strongly about this one, but I do think this guidance slightly improves schema by disallowing array configurations which don't do anything:

Because properties of type array are not candidates for [env var substitution], it typically does not make sense to allow the array to be empty. In some cases, an empty array likely corresponds to an accidental misconfiguration which should be detected and reported as an error. In other cases, an empty array is simply meaningless and the user is better off omitting the property altogether.
For these reasons, minItems is typically set to 1.
NOTE: there are some valid cases where an empty array is semantically meaningful, such as when setting ExplicitBucketHistogram.boundaries.

@jack-berg jack-berg requested a review from a team as a code owner November 5, 2025 20:58
Copy link
Copy Markdown
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jack-berg jack-berg merged commit 12e97d3 into open-telemetry:main Nov 13, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants