Skip to content

Development schema config load#2066

Merged
mbuckton merged 3 commits intodevelopmentfrom
development-schema-config-load
Mar 12, 2026
Merged

Development schema config load#2066
mbuckton merged 3 commits intodevelopmentfrom
development-schema-config-load

Conversation

@mbuckton
Copy link
Copy Markdown
Contributor

Support bundle schemas and child schema resolution

Overview

This change adds support for schema bundles in the server so that a single schema document can expose multiple usable schemas.

Two common cases are now supported:

  • Protobuf descriptor bundles containing many message types
  • JSON schemas containing $defs definitions

Instead of requiring each message type or definition to be stored as an individual schema, the server now:

  1. Loads the bundle schema
  2. Extracts child schemas from the bundle
  3. Registers those children in the schema repository
  4. Resolves the correct schema at message parse time

This allows topics to bind directly to individual message types or $defs entries while still using the original bundle schema as the source of truth.


Key Changes

Schema bundle expansion

When a schema is loaded:

Protobuf

Descriptor sets are inspected and all message definitions are extracted.

Each message type becomes a child schema that references the parent descriptor bundle.

Example:

bundle.desc
 ├── package.Track
 ├── package.CommonHeader
 └── package.Telemetry

Each message is registered as a schema referencing the same descriptor bundle.

JSON

JSON schemas containing $defs are treated as bundles.

Each $defs entry becomes a child schema referencing the parent schema via JSON Pointer.

Example:

schema.json
$defs:
  Track
  CommonHeader
  Telemetry

Children are registered with pointers like:

#/$defs/Track
#/$defs/CommonHeader
#/$defs/Telemetry

Parent-Child Schema Model

Child schemas are linked to their parent bundle.

The parent schema stores the actual schema material, while children store:

  • the definition reference
  • the parent relationship

This avoids duplicating large schema documents or protobuf descriptors.


Formatter Resolution

Formatter creation now uses a resolver so child schemas can obtain their parent bundle when needed.

SchemaManager
    ↓
SchemaResolver
    ↓
MessageFormatter

When parsing a message:

  1. The child schema is selected
  2. The resolver locates the parent bundle
  3. The formatter loads the required definition from the bundle

This ensures:

  • protobuf descriptors are not duplicated
  • JSON $ref resolution continues to work
  • validation occurs with full schema context

Topic Binding

Topics can now bind directly to:

  • Protobuf message types
  • JSON $defs definitions

Example:

Topic: sensors/track
Schema: Track

The server resolves Track to the correct bundle definition automatically.


Benefits

  • Allows large schema bundles to be used directly
  • Avoids duplicating schema definitions
  • Supports fine-grained schema binding per topic
  • Maintains full schema validation context
  • Works for both Protobuf and JSON schemas

Testing

Tests added for:

  • Protobuf message extraction from descriptor bundles
  • JSON $defs extraction
  • JSON pointer resolution
  • JSON formatter validation using parent bundle context

Result

The server can now treat schema bundles as collections of usable schemas, enabling much simpler schema management for large schema sets.

mbuckton added 3 commits March 9, 2026 15:52
…hemaManager

Update the server to support bundle-based schemas using the schema library.

On schema load the server now:
- detects protobuf descriptor bundles and JSON schemas with $defs
- extracts child schemas from the bundle
- registers parent and child schemas in the schema repository
- links children to the parent bundle
- resolves message formatters through SchemaManager using SchemaResolver

This allows topics to bind directly to protobuf message types or JSON $defs
entries while the formatter resolves the parent bundle schema at runtime.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 11, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fa59f5cf-16dc-4b6a-b036-edea4d023d9f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch development-schema-config-load

Comment @coderabbitai help to get the list of available commands and usage tips.

@mbuckton mbuckton merged commit ae6f6fe into development Mar 12, 2026
2 checks passed
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.

2 participants