Repository navigation
feat: add OpenAPI schemas for credentials, presentations and JwsAlgorithm - #126
Conversation
Under `utoipa`, `Credential` and `Presentation` (VCDM 1.1), `CredentialV2`, `PresentationV2`, `EnvelopedVc` and `EnvelopedVp` (VCDM 2.0, feature `vc`) and `JwsAlgorithm` get hand-written schemas like the existing ones: one-or-many members as `oneOf`, open objects where the specification leaves them open, and the specification's required members as `required`. `@context` must begin with the base context (`prefixItems`), issuers and holders are a URI or an object with `id`, a VCDM 1.1 presentation carries compact JWS strings, and an envelope's `id` is a `data:` URL. `JwsAlgorithm` is the enum of its registered names. The schema tests check the VCDM 1.1 and VC-JOSE-COSE examples, and what the types write, against each schema, and the cases the types refuse. Closes #122. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PB1rHNJ3YpjogEUJQYccc2
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Schema foundations and algorithm enum src/openapi.rs |
Adds a JwsAlgorithm string-enum schema and shared helpers for VC schema fields. |
Credential, presentation, and envelope schemas src/openapi.rs, README.md, docs/DESIGN.md, docs/FEATURES.md, src/lib.rs |
Adds schemas for VCDM 1.1 and 2.0 credentials and presentations, plus enveloped credentials and presentations. Updates feature documentation to list the schema coverage. |
Schema registration and validation tests/openapi.rs |
Registers the schemas and tests their component references, valid examples, serialized values, and rejection cases. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature · Severity of issue fixed: Medium
Possibly related issues
- impierce/ssi-agent#439 — This PR adds the
JwsAlgorithmschema that the issue identifies as a replacement for a hand-written algorithm mapping.
Possibly related PRs
- impierce/identity-kit#100 — This PR extends the schema collection and isolated-compilation test infrastructure established by PR
#100.
Suggested labels: Documentation
Merge Risk: 
Minimal · previous review 9f9e1
-
The reviewed schemas have no identified issue that needs resolution before merging. Merge after normal checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#122requiresToSchemasupport forCredential,Presentation,CredentialV2,EnvelopedVc, andJwsAlgorithm, plus schema tests and aFEATURES.mdupdate. The supplied change summary reports all required schemas under the requested feature gates, required members and value-shape rules, resolved-reference tests, VCDM 1.1 and 2.0 example tests, rejection tests, and theFEATURES.mdrow.src/openapi.rsconfirms theJwsAlgorithmenum schema usesJwsAlgorithm::ALL.
Full details: Out of Scope Changes check
-
Explanation
The changes remain connected to issue
#122.PresentationV2andEnvelopedVpextend the same VCDM 2.0 presentation and envelope schema model. Their schemas, references, tests, and documentation support the requested credential and presentation OpenAPI coverage. The supplied change summary shows no unrelated product behavior or unrelated files.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 35 functions across 3 files. (3 skipped: 3 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
|
@coderabbitai review Generated by Claude Code |
✅ Action performed
|
…imedes-echxvg-vc-schemas
Closes #122.
The
utoipafeature described DID documents, keys, the DID configuration, type metadata and status types, but not the credential data model or the algorithm enum. An API returning them had to describe them by hand, as UniCore does inagent_identity/src/connection/openapi.rsanddocument/openapi.rs. Those copies would drift from the types once UniCore uses this crate's.New schemas
Under
utoipa(andvcfor the credential types), written by hand like the existing ones insrc/openapi.rs:Credential@context,type,issuer,issuanceDate,credentialSubjectrequired;id,expirationDate,credentialStatus,credentialSchema,refreshService,termsOfUse,evidence; openPresentation@context,typerequired;verifiableCredentialas compact JWS strings (§6.3.1),holder; openCredentialV2@context,type,issuer,credentialSubjectrequired;name/description(any language value),validFrom,validUntil,credentialStatusone or many,credentialSchema; openPresentationV2verifiableCredentialas$refs toEnvelopedVcEnvelopedVc,EnvelopedVp@context,id(adata:URL),type, all requiredJwsAlgorithmJwsAlgorithm::ALLThe rules these encode:
@context: the base URI alone, or an array whose first element is it (prefixItems), ascheckrequires.issuerandholder: a URI, or an object withid.type.date-timestrings.PresentationV2: itsToSchema::schemasnamesEnvelopedVc, so the$refresolves.typeincludesVerifiableCredential" can't be expressed with utoipa's builders (nocontains), so the description says it.Tests
tests/openapi.rscompiles every schema with its references resolved, alone and together, and checks examples and rejections:vpclaim. Each passes as published and as the types write it back.EnvelopedVp.JwsAlgorithm: every algorithm passes;HS256,none,es256and the empty string fail.id, or a number; no subject; a status entry withouttype; a VCDM 2.0 credential with the 1.1 context; a 1.1 presentation carrying a credential object or a non-JWS string; an envelope whoseidisn't adata:URL, or withoutid.Docs
utoipalists in the crate docs,README.mdandDESIGN.mdname the new types, plusClaimPathandStatusType, which the crate docs had missed.FEATURES.md: a row for OpenAPI schemas forCredential,Presentation,CredentialV2andJwsAlgorithm#122.Checks
All with rustc/clippy 1.99.1:
--all-features --all-targets -D warnings;cargo hack clippy --each-feature -D warnings;-D warnings;cargo test --all-features;--no-default-features --features did-key,softwarebuild;cargo publish --dry-run;cargo semver-checks("no semver update required": the change only adds trait impls).Generated by Claude Code
Summary by CodeRabbit
vcfeature enabled, VCDM 1.1 and 2.0 credentials and presentations, including enveloped forms.