Skip to content

[libgraphql-core-v1] Task 16: Schema struct, SchemaBuilder::build(), OperationKind#102

Merged
jeffmo merged 1 commit into
mainfrom
lgcore_v1_task16
Jun 11, 2026
Merged

[libgraphql-core-v1] Task 16: Schema struct, SchemaBuilder::build(), OperationKind#102
jeffmo merged 1 commit into
mainfrom
lgcore_v1_task16

Conversation

@jeffmo

@jeffmo jeffmo commented Apr 28, 2026

Copy link
Copy Markdown
Owner

Summary

The capstone task that makes the schema pipeline usable end-to-end: parse → load → build → query.

Schema struct

  • Full typed query API: get_type(), object_type(), interface_type(), enum_type(), scalar_type(), union_type(), input_object_type()
  • Typed iterators: object_types(), interface_types(), enum_types()
  • types_implementing(interface_name) — finds all types implementing a given interface
  • Root operation types: query_type(), mutation_type(), subscription_type() (with name accessors)
  • Collection accessors: types(), directive_defs(), source_maps()
  • Serde-serializable for macro crate embedding

SchemaBuilder::build()

5-phase orchestration:

  1. Resolve root query type — explicit schema { query: ... } or implicit "Query" default per spec
  2. Validate root types — must exist and be Object types
  3. Empty type checksEmptyObjectOrInterfaceType, EmptyUnionType, EnumWithNoValues (build-level SchemaBuildErrorKind variants)
  4. Run validators — ObjectOrInterfaceTypeValidator, UnionTypeValidator, InputObjectTypeValidator, validate_directive_definitions
  5. Produce Schema or SchemaErrors

OperationKind enum (pulled forward from Task 18)

  • Query, Mutation, Subscription with Display and From<libgraphql_parser::ast::OperationKind>
  • Used in error variants instead of String for type safety

Test plan

  • 14 new end-to-end tests: minimal build, all type kinds, no query type, non-object root, empty types, invalid interface impl, typed lookups, convenience API, implicit/explicit query resolution, mutation/subscription roots, directive lookups, missing mutation root, empty enum
  • 208 total tests pass
  • cargo clippy --tests -- -D warnings clean

🤖 Generated with Claude Code

@jeffmo jeffmo merged commit 61f055d into main Jun 11, 2026
7 checks passed
@jeffmo jeffmo deleted the lgcore_v1_task16 branch June 11, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant