Skip to content

chore: clean up repo structure and add real schemas#4

Merged
Anusree-J merged 1 commit intomainfrom
chore/cleanup-repo-structure
Apr 8, 2026
Merged

chore: clean up repo structure and add real schemas#4
Anusree-J merged 1 commit intomainfrom
chore/cleanup-repo-structure

Conversation

@Anusree-J
Copy link
Copy Markdown
Contributor

Summary

Restructures the schemas repo around a stable, versioned URL pattern (schemas/<name>/v<version>/schema.json) and replaces placeholder content with real JSON Schemas.

What changed

Cleanup

  • Drop the space-in-name energy credentials/ directory
  • Move schemas/salary-slip/{schema.json,README.md}schemas/salary-slip/v1/
  • Rename the existing schema.json (which was a sample instance, not a JSON Schema) to example.json and add a real JSON Schema alongside it
  • Fix typo (standards|) in root README, list available schemas, document the URL pattern and immutability/versioning policy
  • Add CONTRIBUTING.md describing the add/revise workflow

Real schemas added (under schemas/<name>/v1/ with $id matching their raw GitHub URL)

  • education, employment, identity, health, business — sourced from OpenCred's bundled built-in templates (packages/schema-engine/src/schemas/); these used to point at https://opencred.dev/schemas/... which is unhosted
  • electricity — Customer Credential, sourced from beckn/DEG#208 with upstream attribution in the README

Final tree

schemas/
├── business/v1/{schema.json, README.md}
├── education/v1/{schema.json, README.md}
├── electricity/v1/{schema.json, context.jsonld, example.json, README.md}
├── employment/v1/{schema.json, README.md}
├── health/v1/{schema.json, README.md}
├── identity/v1/{schema.json, README.md}
└── salary-slip/v1/{schema.json, example.json, README.md}

URL pattern

Every schema is reachable at:

https://raw.githubusercontent.com/nfh-trust-labs/opencred-vc-schemas/main/schemas/<name>/v<version>/schema.json

This same URL is the schema's \$id, so JSON Schema processors resolve it directly. OpenCred will reference these URLs in the W3C VC credentialSchema field (follow-up in opencred#300).

Versioning policy

Once v<n> is merged, it is immutable. Breaking and non-breaking shape changes both produce a new v<n+1> directory; older versions stay frozen so existing credentials in the wild keep validating.

Test plan

  • All 7 schema.json files parse as valid JSON
  • All 5 draft-07 schemas compile cleanly with ajv (with ajv-formats)
  • Electricity (draft 2020-12) compiles cleanly with ajv/2020
  • schemas/electricity/v1/example.json validates against its schema
  • schemas/salary-slip/v1/example.json validates against its schema
  • All \$id fields match their raw GitHub URLs

🤖 Generated with Claude Code

Restructure the schemas repo around a stable, versioned URL pattern
(`schemas/<name>/v<version>/schema.json`) and replace placeholder content
with real JSON Schemas.

Cleanup:
- Drop space-in-name `energy credentials/` directory
- Move `schemas/salary-slip/{schema.json,README.md}` -> `schemas/salary-slip/v1/`
- Rename the existing `schema.json` (which was a sample instance, not a
  schema) to `example.json` and add a real JSON Schema alongside it
- Fix typo in root README, list available schemas, document URL pattern
  and immutability/versioning policy
- Add CONTRIBUTING.md describing add/revise workflow

Real schemas added under `schemas/<name>/v1/` with `$id` matching their
raw GitHub URL:
- education, employment, identity, health, business
  (sourced from OpenCred's bundled built-in templates)
- electricity (Customer Credential, sourced from beckn/DEG#208 with
  upstream attribution)

All schemas validated with ajv (draft-07 and 2020-12). Both examples
(electricity, salary-slip) validate against their schemas.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant