# kekavc24/yaml_dart architecture

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

- Interactive diagram: https://gitdiagram.com/kekavc24/yaml_dart
- Repository: https://github.com/kekavc24/yaml_dart

## Overview

This repository is a Dart monorepo for YAML tooling, split into two independently published packages: `rookie_yaml` for parsing/loading YAML, and `dump_yaml` for emitting YAML.

1. **Top-level architecture**
   - The root `README` positions the repo as a YAML 1.2+ ecosystem.
   - The two packages are complementary rather than layered in a single runtime pipeline: one turns YAML text into structured Dart data, the other turns structured Dart data or “dumpable” views back into YAML text.

2. **`rookie_yaml`: input-to-model pipeline**
   - `rookie_yaml` is the parser/loader side.
   - Its architecture is a classic staged pipeline: scanner → parser → document model → schema/loader.
   - This separation is visible in the package structure and is the core boundary diagram for the repo.

3. **Scanning layer**
   - `lib/src/scanner` handles low-level source traversal, character encoding, UTF handling, spans, and error reporting.
   - This layer is responsible for turning raw text into position-aware tokens/events and for producing useful source-location diagnostics.
   - It is the foundation for all higher-level parsing behavior.

4. **Document parser**
   - `lib/src/parser/document` contains the YAML document grammar machinery.
   - It has distinct handling for block nodes, flow nodes, scalars, directives, and parser state.
   - This layer maps scanned input into a typed internal document representation, including YAML-specific features like block scalars, anchors/aliases, tags, and directives.

5. **Schema and node model**
   - `lib/src/schema` defines the node abstractions used after parsing: YAML nodes, comments, scalar values, and schema rules.
   - The document layer feeds this model, which then becomes the main contract for consumers and loaders.
   - This boundary matters because it separates syntax recognition from semantic interpretation.

6. **Resolver and loader behavior**
   - `lib/src/parser/delegates`, `custom_resolvers.dart`, and `lib/src/loaders` implement resolution and loading into Dart objects.
   - The repo supports custom scalar resolvers, tag handling, and object loading, so YAML tags are not just parsed but can be mapped into application types.
   - This is the semantic layer where YAML data becomes Dart values and objects.

7. **YAML feature coverage in `rookie_yaml`**
   - The file layout shows support for anchors/aliases, directives, block and flow collections, quoted/plain scalars, custom tags, and node property inference.
   - The included `yaml_test_suite` runner indicates conformance against upstream YAML test cases, so compatibility is a first-class architectural concern.
   - That means the parser is designed around spec behavior, not just basic mapping/list parsing.

8. **`dump_yaml`: model-to-output pipeline**
   - `dump_yaml` is the emitter side of the system.
   - Its architecture starts from an event/tree representation and then chooses formatting strategies to produce YAML text.
   - This package is about controllable serialization, not parsing.

9. **Dump tree and formatting subsystems**
   - `lib/src/event_tree` builds an intermediate tree of nodes, scalar content, and visitors.
   - `lib/src/dumper` contains the actual output strategies, with distinct block and inline/flow dumpers plus preamble handling.
   - The split suggests a two-step design: normalize the input into a tree, then render that tree with style-aware rules.

10. **Dump configuration and view layer**
   - `lib/src/configs.dart` and `lib/src/views` indicate the dumper supports configurable output and “dumpable” views of application objects.
   - This is the repo’s key abstraction for serialization: callers can expose objects through a view contract instead of requiring direct YAML-specific types.
   - That makes `dump_yaml` suitable for emitting structured application data, not just primitive maps/lists.

11. **Testing strategy**
   - Both packages have extensive package-local tests, and `rookie_yaml` includes YAML test-suite integration.
   - Tests are organized around language features: scalars, maps, sequences, block/flow collections, directives, tags, comments, recursion, and tree building.
   - This reflects the architecture: each parser/dumper subsystem is validated independently.

12. **Repository tooling and automation**
   - GitHub Actions handle routine tests, test reporting, coverage refresh, and bot/label automation.
   - `codecov.yml` shows coverage is reported externally to Codecov.
   - Scripts such as `linear_merge.dart`, `package_filter.dart`, and `test_suite_comment.dart` support CI and repo automation rather than runtime behavior.

13. **How to draw the system boundary**
   - At a high level, treat the repo as two sibling packages under one monorepo:
     - `rookie_yaml`: YAML text in → scanner/parser/schema/loader → Dart data or typed objects.
     - `dump_yaml`: Dart data or dumpable views in → tree/dumper → YAML text out.
   - Shared repo infrastructure (tests, GitHub Actions, coverage, publishing metadata) surrounds both packages but does not participate in the runtime data flow.

Main entry points: [`packages/rookie_yaml/lib/src/parser/document/document_parser.dart`](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/document/document_parser.dart) (Document parser), [`packages/rookie_yaml/test/document_test.dart`](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/test/document_test.dart) (Parser tests), [`.github/workflows/routine-tests.yaml`](https://github.com/kekavc24/yaml_dart/blob/main/.github/workflows/routine-tests.yaml) (GitHub Actions), [`packages/rookie_yaml/lib/src/scanner/source_iterator.dart`](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/scanner/source_iterator.dart) (Scanner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_root["Repo infra"]
  node_node_readme["YAML ecosystem<br/>repo overview<br/>[README.md]"]
  node_node_ci["GitHub Actions<br/>ci/automation<br/>[routine-tests.yaml]"]
  node_node_scripts["Repo scripts<br/>automation scripts<br/>[linear_merge.dart]"]
end

subgraph group_group_rookie["rookie_yaml"]
  node_node_rookie_api["rookie_yaml API<br/>package entrypoint<br/>[rookie_yaml.dart]"]
  node_node_scanner["Scanner<br/>lexing layer"]
  node_node_parser["Document parser<br/>grammar layer"]
  node_node_delegates["Delegates<br/>parse delegation<br/>[node_delegate.dart]"]
  node_node_directives["Directives & tags<br/>tag system<br/>[directives.dart]"]
  node_node_schema["Schema model<br/>node model<br/>[schema.dart]"]
  node_node_loaders["Loaders<br/>object loading<br/>[loader.dart]"]
  node_node_resolvers["Custom resolvers<br/>semantic resolution"]
end

subgraph group_group_dump["dump_yaml"]
  node_node_dump_api["dump_yaml API<br/>package entrypoint<br/>[dump_yaml.dart]"]
  node_node_tree["Event tree<br/>intermediate model<br/>[tree_builder.dart]"]
  node_node_dumper["Dumper<br/>rendering layer<br/>[yaml_dumper.dart]"]
  node_node_views["Views<br/>serialization view<br/>[views.dart]"]
end

subgraph group_group_test["Validation"]
  node_node_rookie_tests["Parser tests<br/>test suite<br/>[document_test.dart]"]
  node_node_yaml_suite["YAML test-suite<br/>conformance harness<br/>[runner.dart]"]
  node_node_dump_tests["Emitter tests<br/>test suite"]
end

node_node_readme -->|"describes"| node_node_rookie_api
node_node_readme -->|"describes"| node_node_dump_api
node_node_ci -->|"runs"| node_node_rookie_tests
node_node_ci -->|"runs"| node_node_dump_tests
node_node_scripts -->|"supports"| node_node_ci
node_node_rookie_api -->|"starts with"| node_node_scanner
node_node_scanner -->|"feeds"| node_node_parser
node_node_parser -->|"uses"| node_node_delegates
node_node_parser -->|"interprets"| node_node_directives
node_node_parser -->|"produces"| node_node_schema
node_node_resolvers -->|"extends"| node_node_loaders
node_node_schema -->|"consumed by"| node_node_loaders
node_node_rookie_tests -->|"verifies"| node_node_scanner
node_node_rookie_tests -->|"verifies"| node_node_parser
node_node_rookie_tests -->|"verifies"| node_node_loaders
node_node_yaml_suite -->|"conforms"| node_node_parser
node_node_dump_api -->|"accepts"| node_node_views
node_node_views -->|"normalizes into"| node_node_tree
node_node_tree -->|"renders via"| node_node_dumper
node_node_dumper -->|"verified by"| node_node_dump_tests
node_node_dump_tests -->|"covers"| node_node_tree

click node_node_readme "https://github.com/kekavc24/yaml_dart/blob/main/README.md"
click node_node_ci "https://github.com/kekavc24/yaml_dart/blob/main/.github/workflows/routine-tests.yaml"
click node_node_scripts "https://github.com/kekavc24/yaml_dart/blob/main/scripts/linear_merge.dart"
click node_node_rookie_api "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/rookie_yaml.dart"
click node_node_scanner "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/scanner/source_iterator.dart"
click node_node_parser "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/document/document_parser.dart"
click node_node_delegates "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/delegates/node_delegate.dart"
click node_node_directives "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/directives/directives.dart"
click node_node_schema "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/schema/schema.dart"
click node_node_loaders "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/loaders/loader.dart"
click node_node_resolvers "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/custom_resolvers.dart"
click node_node_rookie_tests "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/test/document_test.dart"
click node_node_yaml_suite "https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/test/yaml_test_suite/runner.dart"
click node_node_dump_api "https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/dump_yaml.dart"
click node_node_tree "https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/src/event_tree/tree_builder.dart"
click node_node_dumper "https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/src/dumper/yaml_dumper.dart"
click node_node_views "https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/src/views/views.dart"
click node_node_dump_tests "https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/test/tree_builder_test.dart"

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_node_readme,node_node_ci,node_node_scripts toneBlue
class node_node_rookie_api,node_node_scanner,node_node_parser,node_node_delegates,node_node_directives,node_node_schema,node_node_loaders,node_node_resolvers toneAmber
class node_node_dump_api,node_node_tree,node_node_dumper,node_node_views toneMint
class node_node_rookie_tests,node_node_yaml_suite,node_node_dump_tests toneRose
```

## Components

### Repo infra

Monorepo metadata, CI, and automation around both packages.

- [YAML ecosystem](https://github.com/kekavc24/yaml_dart/blob/main/README.md): repo overview · Top-level monorepo framing for YAML 1.2+ tooling. · `README.md`
- [GitHub Actions](https://github.com/kekavc24/yaml_dart/blob/main/.github/workflows/routine-tests.yaml): ci/automation · Workflows and custom actions for testing, coverage, and bot automation. · `.github/workflows/routine-tests.yaml`
- [Repo scripts](https://github.com/kekavc24/yaml_dart/blob/main/scripts/linear_merge.dart): automation scripts · Helper scripts for merge automation, package filtering, and test-suite comments. · `scripts/linear_merge.dart`

### rookie_yaml

YAML text input pipeline: scan, parse, schema, and load.

- [rookie_yaml API](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/rookie_yaml.dart): package entrypoint · Public facade for parsing, loading, and schema-backed YAML input handling. · `packages/rookie_yaml/lib/rookie_yaml.dart`
- [Scanner](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/scanner/source_iterator.dart): lexing layer · Character traversal, encoding, spans, and source-location error reporting. · `packages/rookie_yaml/lib/src/scanner/source_iterator.dart`
- [Document parser](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/document/document_parser.dart): grammar layer · Document parsing and parser state for block/flow nodes, scalars, directives, anchors, and tags. · `packages/rookie_yaml/lib/src/parser/document/document_parser.dart`
- [Delegates](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/delegates/node_delegate.dart): parse delegation · Pluggable node, map-like, sequence-like, and scalar delegation during parsing. · `packages/rookie_yaml/lib/src/parser/delegates/node_delegate.dart`
- [Directives & tags](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/directives/directives.dart): tag system · YAML directives, tag handles, tag forms, and resolver tag parsing. · `packages/rookie_yaml/lib/src/parser/directives/directives.dart`
- [Schema model](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/schema/schema.dart): node model · YAML nodes, comments, scalar values, and schema rules exposed after parsing. · `packages/rookie_yaml/lib/src/schema/schema.dart`
- [Loaders](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/loaders/loader.dart): object loading · Resolution and loading of parsed YAML into Dart values and typed objects. · `packages/rookie_yaml/lib/src/loaders/loader.dart`
- [Custom resolvers](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/lib/src/parser/custom_resolvers.dart): semantic resolution · Custom scalar resolvers and parser-side resolution hooks for application types. · `packages/rookie_yaml/lib/src/parser/custom_resolvers.dart`

### dump_yaml

YAML output pipeline: tree building, formatting, and views.

- [dump_yaml API](https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/dump_yaml.dart): package entrypoint · Public facade for configurable YAML emission and dumpable views. · `packages/dump_yaml/lib/dump_yaml.dart`
- [Event tree](https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/src/event_tree/tree_builder.dart): intermediate model · Normalized tree of nodes, scalar content, and visitor traversal for dumping. · `packages/dump_yaml/lib/src/event_tree/tree_builder.dart`
- [Dumper](https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/src/dumper/yaml_dumper.dart): rendering layer · Block, inline/flow, and preamble formatting strategies that render YAML text. · `packages/dump_yaml/lib/src/dumper/yaml_dumper.dart`
- [Views](https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/lib/src/views/views.dart): serialization view · Dumpable view contracts used to expose application objects to the emitter. · `packages/dump_yaml/lib/src/views/views.dart`

### Validation

Package tests and YAML test-suite conformance harnesses.

- [Parser tests](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/test/document_test.dart): test suite · Feature-focused tests for parsing, loading, node properties, tags, and YAML conformance. · `packages/rookie_yaml/test/document_test.dart`
- [YAML test-suite](https://github.com/kekavc24/yaml_dart/blob/main/packages/rookie_yaml/test/yaml_test_suite/runner.dart): conformance harness · Runner and reporter for upstream YAML test-suite compatibility checks. · `packages/rookie_yaml/test/yaml_test_suite/runner.dart`
- [Emitter tests](https://github.com/kekavc24/yaml_dart/blob/main/packages/dump_yaml/test/tree_builder_test.dart): test suite · Tests for tree building, maps, lists, scalars, comments, recursion, and unfolding behavior. · `packages/dump_yaml/test/tree_builder_test.dart`

## Connections

- YAML ecosystem → rookie_yaml API: describes · Documents the input-side package and its YAML parsing/loading role.
- YAML ecosystem → dump_yaml API: describes · Documents the output-side package and its YAML emission role.
- GitHub Actions → Parser tests: runs · Automates package validation and routine test execution.
- GitHub Actions → Emitter tests: runs · Automates package validation and routine test execution.
- Repo scripts → GitHub Actions: supports · Provides repository automation used by workflows and bot actions.
- rookie_yaml API → Scanner: starts with · Public API builds on source scanning and tokenization.
- Scanner → Document parser: feeds · Scanned input becomes the parser's document grammar input.
- Document parser → Delegates: uses · Parser delegates handle specialized node and collection behaviors.
- Document parser → Directives & tags: interprets · Document parsing resolves directives and tag forms.
- Document parser → Schema model: produces · Parsed documents are materialized into schema-backed nodes.
- Custom resolvers → Loaders: extends · Custom resolution influences how parsed values become Dart objects.
- Schema model → Loaders: consumed by · Schema nodes are the contract passed into loading and object mapping.
- Parser tests → Scanner: verifies · Exercises lexical correctness and diagnostics.
- Parser tests → Document parser: verifies · Exercises document grammar, scalars, directives, and collections.
- Parser tests → Loaders: verifies · Exercises YAML-to-Dart loading and type inference.
- YAML test-suite → Document parser: conforms · Checks parser behavior against upstream YAML cases.
- dump_yaml API → Views: accepts · Public API uses dumpable views as the object-facing abstraction.
- Views → Event tree: normalizes into · Views and source objects are shaped into an intermediate event tree.
- Event tree → Dumper: renders via · Tree nodes are formatted by dumper strategies into YAML text.
- Dumper → Emitter tests: verified by · Emitter behavior is exercised by package-local tests.
- Emitter tests → Event tree: covers · Tests validate normalization and tree-building behavior.
