Learning path / interoperability

Data contracts across four schema ecosystems.

XSD, JSON Schema, OpenAPI and MCP solve overlapping but different problems. This learning path separates instance validation, interface description and agent-facing tool contracts.

Formats04
FocusBoundaries

Three layers are often called “schema”

An instance schema constrains data values. An API description adds operations, transport details and responses. An agent-tool contract adds descriptions intended to help a model decide when and how to call an operation. Treating all three as interchangeable produces conversions that look correct but omit essential behavior.

XSD and JSON Schema

Both describe instance structure and constraints, but their data models differ. XSD is built around XML elements, attributes, namespaces and ordered content. JSON Schema evaluates JSON instances using vocabularies and dialects.

OpenAPI

OpenAPI combines schema objects with paths, operations, parameters, media types, authentication and responses. OpenAPI 3.1 aligns its Schema Object with JSON Schema Draft 2020-12, while the surrounding API description remains its own model.

MCP tools

An MCP tool exposes a name, description and JSON-Schema-based input definition, with optional structured output. The quality of those descriptions matters because a model uses them to choose and populate a tool.

What maps cleanly—and what does not

ConceptXSDJSON Schema / OpenAPIConversion risk
Required valueminOccursrequiredContext differs
Reusable definitionNamed type or group$defs and $refUsually representable
Ordered mixed contentNative XML modelNo direct JSON equivalentLossy
Namespace identityCore mechanismURI identifiers and referencesRequires a policy

Shape does not capture all meaning

A field can be a valid string while carrying the wrong identifier system, unit, timezone or lifecycle state. Defaults can be inserted by one validator and ignored by another. An API operation can have a valid request body while requiring authorization, idempotency or preconditions that are expressed outside the instance schema.

Write these semantics as close as possible to the enforceable boundary. Use schema annotations for stable human explanation, Schematron or application validation for contextual data rules, and the API description for transport and response behavior. Agent-facing descriptions should explain side effects and selection criteria, but they must not be the only place where safety policy exists.

A safer interoperability workflow

  1. Identify the source data model and schema version.
  2. List features with no direct equivalent before conversion.
  3. Convert into a draft contract and preserve a loss report.
  4. Generate valid and invalid examples for both sides.
  5. Compare behavior with real validators, not only syntax.
  6. Version the contract and test subsequent changes for compatibility.

Use the Schema Diff to inspect basic XSD or JSON Schema changes and the OpenAPI-to-MCP readiness analyzer to audit agent-facing operation design.

What to keep with a contract release

Store the schema or description, declared dialect, canonical examples, negative fixtures and validation commands together. Include a concise compatibility statement naming the producer and consumer assumptions. For a conversion, retain the feature inventory and every known lossy mapping rather than publishing only the generated destination file.

For OpenAPI and MCP, test more than schema acceptance. Exercise authentication failure, timeouts, rate limits, empty results, partial success and side-effecting operations. A contract becomes dependable when a reviewer can reproduce both its successful path and its failure boundaries without recovering undocumented behavior from application code.

Assign ownership at every boundary

A contract needs an owner for schema releases, example data, compatibility decisions and deprecation. Consumers need a way to report an ambiguous constraint or a field they cannot process. Record which source is authoritative when XSD, prose, generated code and an API description disagree; otherwise the first production incident becomes the real specification process.

Query set / FAQ

Frequently asked questions

01Is an OpenAPI description the same as a JSON Schema?

No. OpenAPI uses schema objects for instance shapes but also describes paths, operations, parameters, media types, security and responses. The API contract is broader than its embedded data schemas.

02What is lost when XSD is converted to JSON Schema?

XML namespaces, attributes, ordered or mixed content and some type-system behaviors do not have direct JSON equivalents. A safe conversion needs an explicit mapping policy and round-trip tests rather than syntax substitution alone.

03Why does an MCP tool need more than a valid input schema?

A model also needs a precise name and description to select the right capability. Side effects, authorization, error behavior and the meaning of results remain implementation concerns outside the parameter shape.

04How should teams test a cross-ecosystem contract?

Retain representative positive, negative and boundary instances; validate them with the actual processors; and run old consumers against new producer output. Record any conversion assumptions that are not enforced by a schema.