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

Validate examples #300

Merged
merged 19 commits into from
Aug 16, 2024
Merged

Validate examples #300

merged 19 commits into from
Aug 16, 2024

Conversation

lquerel
Copy link
Contributor

@lquerel lquerel commented Aug 8, 2024

This PR introduces validation for the examples attribute field. This validation ensures consistency between the attribute type and the type of the examples. For backward compatibility, an attribute type string[] will be compatible with examples containing a list of strings. In future mode, the only valid examples are a list of lists of strings to match the attribute type.

In future mode, the following attribute will not be valid:

id: attr
type: string[]
brief: bla
examples: ["us-central1", "us-east-1"]

However, this declaration will be valid:

id: attr
type: string[]
brief: bla
examples: [["us-central1"], ["us-east-1"]]

Note: With future mode disabled, both examples are considered valid for backward compatibility.

Example of a registry check with the future mode enabled: weaver registry check --registry <registry-path> --future

Closes #295

@lquerel lquerel changed the title [WIP] feat(resolver): Validate examples Validate examples Aug 8, 2024
@lquerel lquerel marked this pull request as ready for review August 8, 2024 16:14
@lquerel lquerel requested a review from jsuereth as a code owner August 8, 2024 16:14
@lquerel lquerel added the enhancement New feature or request label Aug 8, 2024
@lquerel lquerel self-assigned this Aug 8, 2024
@lquerel lquerel requested a review from a team August 11, 2024 16:54
crates/weaver_semconv/src/attribute.rs Outdated Show resolved Hide resolved
src/registry/check.rs Outdated Show resolved Hide resolved
@lquerel lquerel requested a review from jsuereth August 13, 2024 04:58
@lquerel lquerel merged commit 7553baf into open-telemetry:main Aug 16, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Check that examples have the same type as attribute in weaver
2 participants