liveBook · Manning

Schema validation

As explained in Troubleshooting Java, Second Edition

Schema validation is the process of checking data or schema definitions against declared structural and compatibility rules.

Schema validation checks data or schema definitions against structural and compatibility rules. In distributed systems, it catches serialization mismatches before changed schemas reach consumers. section 12.2

Use automated validation in startup checks or CI to compare the current schema with an earlier version.

  • Treat adding an optional field as usually safe because older clients can ignore it. section 12.2
  • Flag removed or renamed fields and type changes, such as changing a string to an integer, as likely breaking changes. section 12.2
  • Fail the CI job when compatibility checks find changes that could break existing consumers. section 12.2
message Order {
  int64 id = 1;
  string customer_id = 2;
  repeated string items = 3;
  optional string notes = 4;
}

Use the Protobuf schema as the current artifact, then compare it with a previous version using compatibility checks. section 12.2

How Troubleshooting Java, Second Edition covers it

How deep it goes
Compares schema versions and identifies optional-field additions, removals, renames, and type changes, but does not detail validator configuration.
Examples
Uses a Protobuf Order schema and contrasts safe optional-field additions with breaking renames, removals, and type changes.
What it assumes
Assumes independently evolving distributed services, consumer dependencies, and previous schemas available for comparison.
What you can do after
Diagnose compatibility risks with Buf or avro-tools before altered schemas reach dependent consumers.
How it connects
Connects schema validation with serialization, versioning, distributed systems, Protobuf, Avro, JSON Schema, and continuous integration.

Also explained in

Compare how 7 books explain schema validation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Troubleshooting Java, Second Edition. The section links point to the parts of the book it draws on.