Skip to content

Replace version in definition schema with file_format#1154

Merged
jsuereth merged 23 commits intoopen-telemetry:mainfrom
lmolkova:definition-file-format
Feb 26, 2026
Merged

Replace version in definition schema with file_format#1154
jsuereth merged 23 commits intoopen-telemetry:mainfrom
lmolkova:definition-file-format

Conversation

@lmolkova
Copy link
Member

@lmolkova lmolkova commented Jan 23, 2026

Align definition schema marker with resolved schema introduced in #1136

Extracted from #1106

@lmolkova lmolkova requested a review from a team as a code owner January 23, 2026 23:12
@codecov
Copy link

codecov bot commented Jan 23, 2026

Codecov Report

❌ Patch coverage is 84.69388% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.4%. Comparing base (8b71168) to head (df096eb).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
crates/weaver_semconv/src/semconv.rs 88.2% 10 Missing ⚠️
crates/weaver_resolver/src/loader.rs 50.0% 5 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lmolkova lmolkova requested a review from a team as a code owner January 23, 2026 23:31
@lmolkova lmolkova force-pushed the definition-file-format branch from f400877 to 3b3e3c2 Compare February 9, 2026 23:22
@lmolkova lmolkova moved this to To consider for the next release in OTel Weaver Project Feb 18, 2026
@jsuereth jsuereth moved this from To consider for the next release to Next Release in OTel Weaver Project Feb 18, 2026
Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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" to file_format: definition/2 for v2 schema files
  • Added backward compatibility support to accept the deprecated version field with a warning
  • Updated JSON schema from draft-07 to draft 2020-12 with modern syntax ($defs instead of definitions, const instead of single-value enum)
  • 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>
Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

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

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).

@jsuereth
Copy link
Contributor

jsuereth commented Feb 23, 2026

:edited: Add main as of today.

Overall, I'm not happy with the error messages here, example:

ℹ No registry manifest found: dummy-repo/registry_manifest.yaml

Diagnostic report:

  × "Missing required property: \"type\".\n\nMissing required property: \"brief\".\n\nMissing required property: \"stability\".\n\nMissing required property: \"instrument\".
  │ \n\nMissing required property: \"unit\".\n\nMissing required property: \"brief\".\n\nMissing required property: \"stability\"."

Here's main:

Diagnostic report:

  × Value {"attributes":[{"key":"Hello"}],"metrics":[{"attributes":[{"ref":"Hello"}],"name":"test"}],"version":"2"} does not match any schema in a 'oneOf' group; it must match
  │ exactly one.
  │ (Variant 1):
  │ - Value "2" does not match the required constant: "1".
  │ - Object contains unexpected properties: attributes, metrics. These properties are not defined in the schema.
  │ (Variant 2):
  │ - Missing required property: "type".
  │ - Missing required property: "brief".
  │ - Missing required property: "stability".
  │ - Missing required property: "instrument".
  │ - Missing required property: "unit".
  │ - Missing required property: "brief".
  │ - Missing required property: "stability".

@lmolkova
Copy link
Member Author

lmolkova commented Feb 24, 2026

@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 :)

@jsuereth
Copy link
Contributor

@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!

@lmolkova lmolkova force-pushed the definition-file-format branch from 60a70c1 to 86df809 Compare February 24, 2026 21:07
Copy link
Contributor

@jsuereth jsuereth left a comment

Choose a reason for hiding this comment

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

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.

@jsuereth jsuereth enabled auto-merge (squash) February 25, 2026 20:10
@jsuereth jsuereth merged commit 28f8003 into open-telemetry:main Feb 26, 2026
22 checks passed
@github-project-automation github-project-automation bot moved this from Next Release to Done in OTel Weaver Project Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants