# Overview

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.

## Installation

```bash
dotnet add package Hermodr.Schema
```

## What's included

| 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                   |

## Pages in this section

| Page                                                   | Description                                      |
| ------------------------------------------------------ | ------------------------------------------------ |
| [Fluent Builder](/event-schema/fluent-builder.md)      | Build a schema programmatically                  |
| [From Annotations](/event-schema/from-annotations.md)  | Derive a schema from `[Event]`-annotated classes |
| [Export as JSON](/event-schema/export-json.md)         | Serialise a schema to a JSON document            |
| [Export as YAML](/event-schema/export-yaml.md)         | Serialise a schema to a YAML document            |
| [Export as AsyncAPI](/event-schema/export-asyncapi.md) | Generate complete AsyncAPI 2.x documents         |
| [Validation](/event-schema/validation.md)              | Validate `CloudEvent` instances against a schema |

## Schema model at a glance

An `IEventSchema` carries:

* **`Type`** — the event type string (e.g. `"order.placed"`)
* **`Version`** — the SemVer version of the schema
* **`ContentType`** — MIME type of the event data
* **`Description`** — human-readable description
* **`Properties`** — a collection of `IEventProperty` entries, each with:
  * `Name`, `DataType`, `Description`
  * Constraints: `Required`, `Nullable`, `Range<T>`, `Enum`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hermodr.deveel.org/event-schema/schema.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
