Skip to content

feat(schema-adapter): implement adapter for Schema Compilers & Tooling#398

Open
Mohammad-Hassan027 wants to merge 4 commits into
Memact:mainfrom
Mohammad-Hassan027:feat/schema-compiler-adapter-386
Open

feat(schema-adapter): implement adapter for Schema Compilers & Tooling#398
Mohammad-Hassan027 wants to merge 4 commits into
Memact:mainfrom
Mohammad-Hassan027:feat/schema-compiler-adapter-386

Conversation

@Mohammad-Hassan027

Copy link
Copy Markdown

Summary

This PR introduces the SchemaAdapter utility, which acts as a vital bridge for schema compilers and downstream SDK tooling. It dynamically imports and normalizes the two distinct category metadata patterns currently present in the Context repository (legacy contextFields structures and the declarative _SCHEMA object formats) into a single, uniform JSON schema representation.

Protocol Alignment

  • CAP — Context Access Protocol
  • CCP — Context Contribution Protocol
  • CRP — Context Rectification Protocol
  • Identity Address
  • Discovery
  • Evidence Model
  • Temporal Decay
  • Provider Independence
  • Documentation
  • Community Health
  • Other: Schema Compilers & Tooling

Changes Made

  • src/schema-adapter.mjs: Added the SchemaAdapter class to dynamically load, merge, and normalize schema constraints (including sensitivity and durability rules) from category modules.
  • src/engine.mjs: Exposed SchemaAdapter as a top-level export on the engine.
  • package.json: Added the ./schema-adapter entry point to the exports map to allow clean integration by external compilers.
  • test/schema-adapter.test.mjs: Added focused unit tests validating the accurate parsing of both Format 1 (e.g., fitness, dining) and Format 2 (e.g., learning, gaming) categories, alongside parallel schema resolution.

Testing

  • Unit tests added/updated
  • Manual testing done
    • Ran npm test to ensure native Node.js tests cover all edge cases, successfully validating 11/11 tests, including loading all 34 categories dynamically without runtime failures.
  • Integration tests pass

Checklist

  • Code follows the repo's style guidelines
  • Self-reviewed before opening PR
  • No breaking changes to protocol-level interfaces (or documented in description)
  • CHANGELOG updated if applicable

Linked Issue

Closes #386

@Mohammad-Hassan027

Copy link
Copy Markdown
Author

Hey team, everything is green, fully tested, and ready to go. Mind taking a quick look so we can get this merged? CC: @keepsloading

@Mohammad-Hassan027

Copy link
Copy Markdown
Author

Hey @keepsloading , dropping a quick bump on this. I need to get this adapter merged so I can unblock and start working on the next set of issues dependent on it.

Everything is green and fully covered by the new unit tests. Let me know if you need any adjustments!

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.

[Medium] Implement adapter for Schema Compilers & Tooling

1 participant