The Hermodr.Schema package adds the ability to formally describe the structure of your events — what properties they carry, their types, and constraints — and to validate CloudEvent instances against those descriptions before publishing.
dotnet add package Hermodr.Schema| Type | Role |
|---|---|
IEventSchema / EventSchema |
The schema model |
EventSchemaBuilder |
Fluent API for building a schema in code |
EventSchemaCreator |
Derives a schema from an annotated class using reflection |
IEventSchemaFactory |
DI-friendly factory wrapping EventSchemaCreator |
IEventSchemaWriter |
Abstraction for schema serialisation (JSON, YAML, AsyncAPI) |
EventSchemaJsonWriter |
Serialises a schema to JSON |
IEventSchemaValidator |
Validates a CloudEvent against a schema |
| Page | Description |
|---|---|
| Fluent Builder | Build a schema programmatically |
| From Annotations | Derive a schema from [Event]-annotated classes |
| Export as JSON | Serialise a schema to a JSON document |
| Export as YAML | Serialise a schema to a YAML document |
| Export as AsyncAPI | Generate complete AsyncAPI 2.x documents |
| Validation | Validate CloudEvent instances against a schema |
| Validation at Publish Time | Automatic schema validation via middleware |
| Compatibility | Compare schema versions and detect breaking changes |
| Upcasting | Migrate legacy event payloads to newer schema versions |
An IEventSchema carries:
Type— the event type string (e.g."order.placed")Version— the SemVer version of the schemaContentType— MIME type of the event dataDescription— human-readable descriptionProperties— a collection ofIEventPropertyentries, each with:Name,DataType,Description- Constraints:
Required,Nullable,Range<T>,Enum