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

Object and enum types should be defined in $defs #155

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

jack-berg
Copy link
Member

More cleanup as we approach stability.

Here I ensure the schema consistently uses JSON schema's schema / subschema options with a new schema modeling rule:

In order to promote stylistic consistency and allow for reuse of concepts, object and enum types should be defined in either as a top level schema document or as a subschema in a schema document's $defs.

The stylistic consistency part is obvious.

"allow for reuse of concepts" is less obvious. When a type is defined in $defs we can reference as many times as needed in properties. When a type is defined directly in a property (or inline if you prefer), that type can only describe the requirements for that single property.

This guidance applies to object and enum types. This means that excluded are all primitives and arrays.

@jack-berg jack-berg requested a review from a team as a code owner January 14, 2025 20:40
@jack-berg jack-berg changed the title Object and enum types should be defined in Object and enum types should be defined in $defs Jan 14, 2025
README.md Outdated Show resolved Hide resolved
Copy link
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, see minor changes.

@jack-berg jack-berg merged commit 134fa1e into open-telemetry:main Jan 15, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants