Replace version in definition schema with file_format#1154
Replace version in definition schema with file_format#1154jsuereth merged 23 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1154 +/- ##
=====================================
Coverage 80.4% 80.4%
=====================================
Files 110 110
Lines 9009 9021 +12
=====================================
+ Hits 7245 7258 +13
+ Misses 1764 1763 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f400877 to
3b3e3c2
Compare
jsuereth
left a comment
There was a problem hiding this comment.
Overall looks good, two major questions:
- One on errors and what they look like wrapped now
- Another on whether we should update the file format error message
There was a problem hiding this comment.
Pull request overview
This PR replaces the version field with file_format in the definition schema to align with the resolved schema introduced in PR #1136. This is a breaking change that affects how version 2 semantic convention files are identified.
Changes:
- Updated field name from
version: "2"tofile_format: definition/2for v2 schema files - Added backward compatibility support to accept the deprecated
versionfield with a warning - Updated JSON schema from draft-07 to draft 2020-12 with modern syntax (
$defsinstead ofdefinitions,constinstead of single-valueenum) - Split schema validators to handle v1 and v2 separately for better error messages
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/v2_forge/model/test.yaml | Updated to use file_format: definition/2 |
| tests/v2_check_before_resolution/test.yaml | Updated to use file_format: definition/2, removed trailing whitespace |
| tests/v2_check_baseline/next/test.yaml | Updated to use file_format: definition/2, removed trailing whitespace |
| tests/v2_check_baseline/base/test.yaml | Updated to use file_format: definition/2, removed trailing whitespace |
| tests/v2_check/model/test.yaml | Updated to use file_format: definition/2, removed trailing whitespace |
| schemas/semconv.schema.v2.json | Updated to JSON Schema draft 2020-12, modernized syntax with $defs and const |
| schemas/semconv-syntax.v2.md | Updated documentation to reflect file_format: definition/2 usage |
| schemas/semconv-syntax.md | Minor formatting improvements in table of contents |
| crates/weaver_semconv/src/semconv.rs | Core logic for handling both old and new format, deprecation warnings, and custom deserialization |
| crates/weaver_semconv/src/registry.rs | Updated to use separate validators for v1 and v2 |
| crates/weaver_semconv/src/lib.rs | Added new error types for deprecated field and invalid format |
| crates/weaver_semconv/src/json_schema.rs | Removed new_versioned(), exposed new_for() as public |
| crates/weaver_semconv/README.md | Updated terminology from "YAML language" to "Definition language" |
| crates/weaver_resolver/src/registry.rs | Updated test to ignore new deprecation warning |
| crates/weaver_resolver/src/loader.rs | Updated to use separate validators for v1 and v2 |
| crates/weaver_resolver/data/registry-test-v2-3-both-version/registry/*.yaml | Updated test files to use file_format: definition/2 |
| crates/weaver_resolver/data/registry-test-v2-2-multifile/registry/*.yaml | Updated test files to use file_format: definition/2 |
| crates/weaver_resolver/data/registry-test-v2-1-everything/registry/http.yaml | Updated test file to use file_format: definition/2 |
| crates/weaver_resolver/data/registry-test-16-attr-conflict/registry/test-16.yaml | Updated test file to use file_format: definition/2 |
| crates/weaver_forge/data/registry/http.yaml | Still uses deprecated version: "2" - may be intentional for backward compatibility testing |
| CHANGELOG.md | Added breaking change entry (contains a typo) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jsuereth
left a comment
There was a problem hiding this comment.
Still rust structural concerns. I'm going to check this out locally and take a look, then come back with any hard suggestions (or a PR against your PR).
|
:edited: Add Overall, I'm not happy with the error messages here, example: Here's main: |
|
@jsuereth I refactored it quite a bit now, but I did not solve messages problem. I also don't believe I made it worse and it seems to produce the same as the released version. Mind sharing the tyaml you're running? I don't mind fixing it at all, but if it's not introduced in this PR, I'd rather do it separately :) |
|
@lmolkova I'll take a look, and the formatting I was able to confirm head vs. this PR that this PR was the cause as of yesterday. I'll re-evaluate the updates, thanks for taking a look! |
60a70c1 to
86df809
Compare
jsuereth
left a comment
There was a problem hiding this comment.
I'm good with this as an interim state we'll clean up.
- I'm not super happy with creating temp files, but it's just for tests. That could be cleaned up, but we can do so later.
- The code is a LOT easier to read now, thank you. Think we should be able to maintain this for the time it takes to migrate to v2.
Align definition schema marker with resolved schema introduced in #1136
Extracted from #1106