You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The claims engine should reference regen-data-standards (https://framework.regen.network/schema/) as its canonical schema vocabulary, rather than maintaining an independent ad-hoc schema. This is the single most important alignment issue for interop with the CLAMS CosmWasm contract (Spec B) and downstream consumers.
Context
The Framework Working Group (FWG) maintains LinkML schemas at regen-network/regen-data-standards that auto-generate JSON-LD contexts, JSON Schema, SHACL constraints, and RDF/TTL. The schemas use the rfs: (https://framework.regen.network/schema/) and rft: (https://framework.regen.network/taxonomy/) namespaces.
In claims_router.py:_canonical_json(), prepend context fields:
def_canonical_json(claim_data: dict) ->str:
"""Build canonical JSON representation with FWG @context. The @context makes this valid JSON-LD without requiring full RDFC 1.0 canonicalization. The @type references the FWG Claim class from regen-data-standards. """canonical= {
"@context": "https://framework.regen.network/schema/",
"@type": "rfs:Claim",
# ...existing fields in canonical order...
}
returnjson.dumps(canonical, sort_keys=True, separators=(',', ':'))
IMPORTANT: Adding @context changes the canonical form, which means new claims will produce different content hashes than old claims. This is a breaking change for RID generation — coordinate with #12 (hash unification) so both changes land together.
2. Same for _canonical_claim_json() in ledger_anchor.py
This is hard validation — reject invalid types at the API boundary. The values map directly to the ClaimType enum in regen-data-standards/schema/src/taxonomy.yaml (ECOLOGICAL, SOCIAL, FINANCIAL, GOVERNANCE, BIOCULTURAL), normalized to lowercase for storage.
Summary
The claims engine should reference
regen-data-standards(https://framework.regen.network/schema/) as its canonical schema vocabulary, rather than maintaining an independent ad-hoc schema. This is the single most important alignment issue for interop with the CLAMS CosmWasm contract (Spec B) and downstream consumers.Context
The Framework Working Group (FWG) maintains LinkML schemas at
regen-network/regen-data-standardsthat auto-generate JSON-LD contexts, JSON Schema, SHACL constraints, and RDF/TTL. The schemas use therfs:(https://framework.regen.network/schema/) andrft:(https://framework.regen.network/taxonomy/) namespaces.Claim and Attestation schemas have been proposed: regen-network/regen-data-standards#53 (PR open, replaces original issue #52).
Dependencies
@contextandClaimTypeenum)@contextchanges the canonical JSON, which changes hashesChanges Required
@contextto canonical claim serializationcredit_class_idfieldImpact
Related
Implementation Spec (for Darren)
1. Add
@contextto_canonical_json()In
claims_router.py:_canonical_json(), prepend context fields:IMPORTANT: Adding
@contextchanges the canonical form, which means new claims will produce different content hashes than old claims. This is a breaking change for RID generation — coordinate with #12 (hash unification) so both changes land together.2. Same for
_canonical_claim_json()inledger_anchor.py3. Validate
claim_typeagainst FWG taxonomyAdd a Pydantic validator to
ClaimCreateRequest:This is hard validation — reject invalid types at the API boundary. The values map directly to the
ClaimTypeenum inregen-data-standards/schema/src/taxonomy.yaml(ECOLOGICAL, SOCIAL, FINANCIAL, GOVERNANCE, BIOCULTURAL), normalized to lowercase for storage.4. Add
credit_class_idfieldNew Alembic migration:
Add to
ClaimCreateRequest:Include in canonical JSON when present:
5. Add
@contextto proof pack responseUpdate the proof pack endpoint (
GET /claims/{rid}/proof-pack) response model:This makes the proof pack output valid JSON-LD. Sam can use this directly for Spec B's JSON-LD deliverable.
6. Breaking change coordination
Coordinate with #12 (hash unification):
@contextto canonical JSON changes the hash output@contextMigration path:
Acceptance Criteria
_canonical_json()includes@contextand@typefields_canonical_claim_json()inledger_anchor.pyincludes@contextand@typeclaim_typevalidated againstVALID_CLAIM_TYPES(rejects invalid types with helpful error)credit_class_id TEXTcolumn with indexClaimCreateRequestaccepts optionalcredit_class_id@contextand@type(valid JSON-LD)