# kalasjocke/hyp architecture

> Architecture diagram of the GitHub repository kalasjocke/hyp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kalasjocke/hyp
- Repository: https://github.com/kalasjocke/hyp

## Overview

Hyp is a small Python library for building JSON:API-style response documents from models or primitives. An application supplies a responder and serializer, then calls `build` for a Python dictionary or `respond` for JSON text. The base responder constructs resource, relationship-link, linked-resource, and optional metadata sections; a selected Marshmallow or Schematics adapter serializes each resource. The graph shows the two documented adapter choices and their serializer dependencies. Runtime relationships are supported by the README or shown source excerpts.

Main entry points: [`hyp/base.py`](https://github.com/kalasjocke/hyp/blob/master/hyp/base.py) (Base responder), [`hyp/marshmallow.py`](https://github.com/kalasjocke/hyp/blob/master/hyp/marshmallow.py) (Marshmallow adapter), [`hyp/schematics.py`](https://github.com/kalasjocke/hyp/blob/master/hyp/schematics.py) (Schematics adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_response["Response construction"]
  node_responder["Base responder<br/>[base.py]"]
  node_document["Response document<br/>[base.py]"]
  node_json_text["JSON text<br/>[base.py]"]
end

subgraph group_adapters["Serialization adapters"]
  node_marshmallow_adapter["Marshmallow adapter<br/>[marshmallow.py]"]
  node_schematics_adapter["Schematics adapter<br/>[schematics.py]"]
end

node_developer(("Application developer"))
node_marshmallow["Marshmallow schema"]
node_schematics["Schematics model"]

node_developer -->|"calls"| node_responder
node_responder -.->|"selects adapter"| node_marshmallow_adapter
node_responder -.->|"selects adapter"| node_schematics_adapter
node_responder -->|"builds"| node_document
node_responder -->|"encodes"| node_json_text
node_marshmallow_adapter -->|"dumps with"| node_marshmallow
node_schematics_adapter -->|"converts with"| node_schematics

click node_responder "https://github.com/kalasjocke/hyp/blob/master/hyp/base.py"
click node_marshmallow_adapter "https://github.com/kalasjocke/hyp/blob/master/hyp/marshmallow.py"
click node_schematics_adapter "https://github.com/kalasjocke/hyp/blob/master/hyp/schematics.py"
click node_document "https://github.com/kalasjocke/hyp/blob/master/hyp/base.py"
click node_json_text "https://github.com/kalasjocke/hyp/blob/master/hyp/base.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_responder,node_document,node_json_text toneBlue
class node_marshmallow_adapter,node_schematics_adapter toneAmber
class node_developer,node_marshmallow,node_schematics toneIndigo
```

## Components

### Response construction

- [Base responder](https://github.com/kalasjocke/hyp/blob/master/hyp/base.py): `hyp/base.py`
- [Response document](https://github.com/kalasjocke/hyp/blob/master/hyp/base.py): `hyp/base.py`
- [JSON text](https://github.com/kalasjocke/hyp/blob/master/hyp/base.py): `hyp/base.py`

### Serialization adapters

- [Marshmallow adapter](https://github.com/kalasjocke/hyp/blob/master/hyp/marshmallow.py): `hyp/marshmallow.py`
- [Schematics adapter](https://github.com/kalasjocke/hyp/blob/master/hyp/schematics.py): `hyp/schematics.py`

### Other components

- **Application developer**
- **Marshmallow schema**
- **Schematics model**

## Connections

- Application developer → Base responder: calls (evidence: `README.md`)
- Base responder → Marshmallow adapter: selects adapter (evidence: `hyp/marshmallow.py`)
- Base responder → Schematics adapter: selects adapter (evidence: `hyp/schematics.py`)
- Base responder → Response document: builds (evidence: `hyp/base.py`)
- Base responder → JSON text: encodes (evidence: `hyp/base.py`)
- Marshmallow adapter → Marshmallow schema: dumps with (evidence: `hyp/marshmallow.py`)
- Schematics adapter → Schematics model: converts with (evidence: `hyp/schematics.py`)
