feat: add OCI Annotations constants#351
feat: add OCI Annotations constants#351wangxiaoxuan273 wants to merge 1 commit intooras-project:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #351 +/- ##
=======================================
Coverage 91.76% 91.76%
=======================================
Files 64 64
Lines 2755 2755
Branches 364 364
=======================================
Hits 2528 2528
Misses 138 138
Partials 89 89 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds a new public constants surface for standard OCI image annotation keys (per OCI Image Spec v1.1.1), along with unit tests to prevent accidental value drift. This fits into the OrasProject.Oras.Oci model/constants area similarly to existing Oci.MediaType.
Changes:
- Introduces
OrasProject.Oras.Oci.Annotationswith constants for standard OCI annotation keys. - Adds
AnnotationsTestto assert all constants match the spec-defined strings.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/OrasProject.Oras/Oci/Annotations.cs | New public constants class exposing OCI annotation keys with XML docs + spec link. |
| tests/OrasProject.Oras.Tests/Oci/AnnotationsTest.cs | Unit test validating all annotation constant values. |
bce76ca to
cd12717
Compare
- Remove 'Annotation' prefix from XML doc names to match actual constant names - Put const assignments on single lines per codebase style Signed-off-by: Xiaoxuan Wang <[email protected]>
cd12717 to
7e54d61
Compare
|
Caution This review was generated by Copilot using Claude Opus 4.6, mimicking the review style of shizhMSFT. This is not the real shizhMSFT. Review of PR #351 Verified all 14 constants match OCI Image Spec v1.1.1 1. The Go spec uses 2. XML docs should link spec sections directly The class-level doc links to the annotations page, which is good. But individual constant docs could benefit from noting which spec section defines them — especially 3. nit: Test asserts each value individually but could use 14 assertions in a single [Theory]
[InlineData(nameof(Annotations.Created), "org.opencontainers.image.created")]
[InlineData(nameof(Annotations.Authors), "org.opencontainers.image.authors")]
// ...
public void OciAnnotation_HasCorrectValue(string name, string expected)
{
var field = typeof(Annotations).GetField(name);
Assert.Equal(expected, field!.GetValue(null));
}Otherwise SGTM. |
What this PR does / why we need it
Adds standard OCI annotation key constants per the OCI Image Spec v1.1.1 annotations.
Includes a test file that validates all constant values.
Which issue(s) this PR resolves / fixes
Part of the File Store implementation split (issue 1 of 10).
Related: #328, #37
Please check the following list