Skip to main content

Framework

ModelGraphGenerator

Generate JSON Schema from Swift models automatically. Annotate your structs with @ChimeraSchema, and ModelGraphGenerator discovers every model, resolves inheritance and cycles, and emits Draft 2020-12 compliant schemas.

See it in action

Annotate a Swift model and generate a complete JSON Schema in seconds.

Swift Model
@ChimeraSchema(key: "product")
struct Product {
    @ChimeraProperty(description: "Product name",
                     minLength: 1)
    let name: String

    @ChimeraProperty(description: "Price in USD",
                     min: 0.0)
    let price: Double

    let categories: [String]
    let inStock: Bool
}
JSON Schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Product name",
      "minLength": 1
    },
    "price": {
      "type": "number",
      "description": "Price in USD",
      "minimum": 0.0
    },
    "categories": {
      "type": "array",
      "items": { "type": "string" }
    },
    "inStock": { "type": "boolean" }
  },
  "required": ["name", "price",
    "categories", "inStock"]
}

Capabilities

Powerful, zero-config schema generation that works with your existing Swift code.

Simple Annotations

Three macros — @ChimeraSchema, @ChimeraProperty, @ChimeraMetaData — are all you need. No configuration files, no build plugins.

JSON Schema Draft 2020-12

Generates standard JSON Schema Draft 2020-12, compatible with OpenAPI 3.1, AJV, and all major schema validators and code generators.

Multi-Strategy Discovery

Finds models via macro scanning and IndexStoreDB protocol conformance — works regardless of how your Swift project is structured.

Polymorphic Types

Use @ChimeraPolymorphic and @PolymorphicMapping to generate oneOf schemas with discriminator fields for protocol-backed polymorphic types.

Rich Constraints

Attach minLength, maxLength, pattern, min,max, and more directly to your Swift properties.

Fast CLI

Single command, seconds to run. Use --macro-only to scan only annotated files and speed up large codebases even further.