Skip to content

Add schema modeling guidance for enum values as lower_snake_case#445

Merged
jack-berg merged 5 commits intoopen-telemetry:mainfrom
jack-berg:consistent-enum-value-casing
Dec 9, 2025
Merged

Add schema modeling guidance for enum values as lower_snake_case#445
jack-berg merged 5 commits intoopen-telemetry:mainfrom
jack-berg:consistent-enum-value-casing

Conversation

@jack-berg
Copy link
Copy Markdown
Member

Realized we don't consistently model enum value types when reviewing this spec PR.

Ideally, we would have case insensitive enums, but JSON schema doesn't support those without resorting to using regex patterns.

Choosing snake case because we already have modeling guidance saying that property names are snake case.

@jack-berg jack-berg requested a review from a team as a code owner December 2, 2025 21:56
Copy link
Copy Markdown
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

Should the values be case-insensitive? Do we want to distinguish between info and INFO?

@jack-berg
Copy link
Copy Markdown
Member Author

JSON schema doesn't support case insensitive enum values @MrAlias. I would be in favor of case insensitivity if we could express it reasonably

1 similar comment
@jack-berg
Copy link
Copy Markdown
Member Author

JSON schema doesn't support case insensitive enum values @MrAlias. I would be in favor of case insensitivity if we could express it reasonably

@MrAlias
Copy link
Copy Markdown
Contributor

MrAlias commented Dec 4, 2025

In that case, can we use uppercase snake case to match existing definitions like the log severity?

@jack-berg
Copy link
Copy Markdown
Member Author

See #449.

Notably:

Advantage of upper snake case is that enums stick out very clearly.
Disadvantage is that more types are impacted:

  • lower_snake_case impacts 2 types, both of which are experimental
  • UPPER_SNAKE_CASE impacts 7 types, one of which is experimental, 6 of which are on stack to stabilize

Comment thread schema/logger_provider.yaml Outdated
@codeboten
Copy link
Copy Markdown
Contributor

i prefer the lower case to upper case option

Copy link
Copy Markdown
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

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

If you can address the conflicts and update the description for the enum, i think we can move this forward

@MrAlias
Copy link
Copy Markdown
Contributor

MrAlias commented Dec 8, 2025

I don't have a strong preference on casing. Just more used to the upper-case.

Copy link
Copy Markdown
Member

@JamieDanielson JamieDanielson left a comment

Choose a reason for hiding this comment

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

Prefer lower_snake_case but either is probably fine 😄

@jack-berg jack-berg merged commit 987c78b into open-telemetry:main Dec 9, 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.

4 participants