ElevenID
ElevenID LLC
All Posts
Technical
5 min read
JSON Schema
implementation

MIP JSON Schemas: A Walkthrough for Implementers

MIP publishes Draft 2020-12 JSON Schemas for its core primitives and supporting entities. This walkthrough shows how to validate payloads, generate typed bindings, and keep implementation contracts aligned.

Daniel Ortega | Protocol Architect - Identity Protocol DesignMarch 28, 2025 | Updated July 13, 2026 | 5 min read | Technical
OID4VCI Issuance
OID4VP Presentation
Protocol Architecture
Interoperability Design
Part of the Marty Identity Protocol
Series

Implementation Guides

Layer

Issuance

Topic

Implementation

Difficulty
Intermediate

One of MIP's most immediately useful artifacts is its JSON Schema surface. A protocol model becomes easier to evaluate when implementers can inspect object shapes, validate documents, and generate language bindings without relying on prose alone.

The schemas make the model testable; they are not proof that an implementation is operationally correct. They establish a machine-readable structural baseline for Trust Profiles, Credential Templates, Presentation Policies, Deployment Profiles, Flows, and the supporting entities around them. Behavioral correctness still depends on the specification, policy evaluation, conformance tests, and runtime behavior.

The useful implementation order is straightforward: pin the protocol version, validate at system boundaries, generate types where they help, and test the semantic rules that JSON Schema cannot express.

Start with the normative order

MIP's root specification is normative. The JSON Schemas define the machine-readable structure of protocol entities, but the specification explicitly takes precedence if normative text and a schema conflict. That distinction matters during implementation and review: schema validity is necessary for a conforming payload, but it is not the whole conformance decision.

Use schemas from the same pinned release or commit as the specification your implementation targets. Do not let a production validator resolve mutable main-branch references over the network at request time. Vendor or cache the matching schema set, register its $id values locally, and update the specification, schemas, generated bindings, examples, and tests as one reviewed change.

Read a schema from the outside in

MIP entity schemas declare JSON Schema Draft 2020-12. Start with $schema and $id, then inspect title, type, required, additionalProperties, properties, and any $ref links into shared vocabularies. The required list defines the minimum structural contract. Enum and pattern constraints narrow values. additionalProperties: false prevents implementations from silently inventing fields outside the contract.

The abbreviated Trust Profile header below shows that structure. The full schema continues into trust sources, algorithms, credential formats, revocation behavior, time policy, issuer controls, and compliance state.

jsonAbbreviated Trust Profile schema header
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/marty-protocol/marty-protocol/main/schemas/trust-profile.json",
  "title": "TrustProfile",
  "type": "object",
  "required": [
    "id",
    "organization_id",
    "name",
    "profile_type",
    "trust_sources",
    "allowed_algorithms",
    "supported_formats",
    "compliance_status",
    "created_at"
  ],
  "additionalProperties": false
}
Validate at system boundaries

Validation is most useful before an object becomes durable or executable. Validate a Credential Template before activation, a Presentation Policy before a verifier can select it, a Deployment Profile before configuration reaches a lane, and incoming protocol objects before application code interprets them. Run the same validation over examples and fixtures in continuous integration so contract drift fails early.

The repository includes a validation script that can use ajv-cli or check-jsonschema, plus a test registry that resolves local schema and enum references. It also includes a deterministic code-generation check for the committed Python, Rust, and TypeScript bindings.

bashValidate an example and check generated bindings
./scripts/validate.sh --data examples/minimal/trust-profile.json --schema schemas/trust-profile.json
python scripts/codegen.py --check

Validator configuration still matters. In JSON Schema, format keywords such as uuid, uri, and date-time are not enforced identically by every library. Enable the validator's format support, load referenced schemas through a controlled registry, and test both valid and invalid fixtures. A green parse is not enough if the runtime skipped the constraints you expected it to enforce.

Generate types without confusing them with validation

MIP's code-generation pipeline produces Pydantic models for Python, serde-oriented structs and enums for Rust, and interfaces and enums for TypeScript. Generated bindings reduce field-name and enum drift across implementations, and the --check mode lets continuous integration detect when committed outputs no longer match the schema source.

Generated types are a development aid, not a substitute for runtime validation. TypeScript interfaces disappear at runtime. Generated models may not capture every cross-field or protocol rule. Keep JSON Schema validation at trust boundaries, then apply the normative and policy checks required for the operation.

This separation catches a common interoperability failure: two implementations claim to support the same object while disagreeing about required fields, enum values, or nested structures. Shared schemas and generated bindings catch much of that drift. Conformance tests determine whether both implementations assign the same meaning and behavior to the valid structure.

Inspect the contract surfaces directly

The protocol repository keeps the normative specification, schemas, examples, validation tooling, generated bindings, and Cedar policy schema together. That gives implementers a direct review path: read the normative rule, inspect the entity schema, validate a minimal or realistic example, and then compare the generated model used by the target language.

MIP contract surfaces

These public repository paths lead to the specification and implementation artifacts described in this walkthrough.

Marty Identity Protocol repository

The open-source protocol repository.

Normative specification

The source of normative protocol behavior and precedence.

JSON Schemas

Machine-readable contracts for core primitives and supporting entities.

Example corpus

Minimal and realistic payloads used to exercise the schemas.

Validation and code generation

Repository tooling for schema validation and reproducible language bindings.

Reference bindings

Generated Python, Rust, and TypeScript contract models.

What schemas do not replace

JSON Schema is structural. It can require a field, constrain a value, close undeclared properties, and connect shared definitions. It cannot, by itself, prove that a Trust Profile is operationally safe, that a Presentation Policy is proportionate, that a referenced issuer is authorized, or that a Flow represents a sensible user journey. Those decisions still need protocol rules, policy review, conformance tests, and implementation discipline.

That limitation is worth stating because schema-backed projects often confuse structural validity with system correctness. A credential template can be valid JSON and still ask for the wrong claims. A presentation policy can conform to the schema and still over-collect. The schema tells implementers whether the object is shaped correctly; governance still decides whether the object is appropriate.

That is why MIP uses schemas as one layer of the contract rather than the whole contract. The specification defines normative behavior. Cedar policies govern authorization. Compliance Profiles map ecosystem requirements. Conformance tests exercise valid and invalid behavior. The schemas keep the object structure stable enough for those layers to work together.

Treat schemas as a pinned, testable structural contract. Validate at boundaries, keep generated and handwritten models aligned, and reserve conformance claims for evidence that includes the protocol's semantic rules. Read Conformance Testing next to see how those structural contracts become implementation evidence.

This article was produced by an AI research persona and reviewed by the ElevenID editorial team. All technical claims are validated against protocol specifications and reference implementations.
Daniel Ortega

Protocol Architect - Identity Protocol Design

Daniel studies the design of identity protocols and how systems exchange verifiable claims between issuers, holders, and verifiers. His work explains the underlying mechanics of decentralized identity protocols.

OID4VCI Issuance
OID4VP Presentation
Protocol Architecture
Interoperability Design
Protocol Flows
AI research persona representing curated protocol analysis.
Start issuing

From templates to live credentials - the issuance API handles formatting, signing, and delivery.