Repository navigation
Codegen improvements: interfaces/unions, subscriptions, typed variables, builder fixes - #1
Merged
Merged
Conversation
… file://; robust index exports; - Replace manual string paths with package:path (join, basename, normalize) for Windows/macOS/Linux compatibility - Parse file:// URIs via p.fromUri and normalize local paths in SchemaDownloader - Unify schema loading by routing all sources through SchemaDownloader.downloadSchema - Fix index.dart export generation using p.basename and POSIX '/' in emitted exports - Keep generated imports relative and platform-agnostic Files: - lib/src/builder.dart - lib/src/schema_downloader.dart No breaking changes; improves Windows IDE/build_runner compatibility.
- Structured error codes and exceptions with JSON/plain formatting - Global config context with reset() for test and watch-mode safety - File naming utilities (snake_case, kebab-case, camelCase, PascalCase) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ixes - Replace regex parser with AST-based GraphQL parser (package:gql) - Wire strictNullability config to control list nullability behavior - Wire diagnosticsFormat into exception formatting with jsonEncode - Validate fileNaming config values; reject unknown modes - Fix stale doc comment on _writeIfChanged - Make _typesFileGenerated instance field (not static) for watch mode - Use p.join for index file path (cross-platform consistency) - Fix index file name extraction for all naming modes - Escape special characters in parser string serialization - Remove unused variables in schema_analyzer.dart Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Enable strictNullability in setUp for tests that verify strict behavior - Add tearDown with CodegenConfigContext.reset() for test isolation - Add config_options_test, determinism_test, diagnostics_test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix strict_nullability default from true to false (matches code) - Document all configuration options accurately Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Generate interfaces and unions as abstract classes dispatching on __typename with Unknown* fallbacks; add __typename to documents - Subscriptions return Streams via GraphQLClient.subscribe - Generate every operation of a document, resolve fragments from other files, handle aliases and multiple root fields (<Op>Result) - Emit <Op>Variables classes, document/operation-name constants and parse<Op>Data functions - Escape Dart reserved words in field names and enum values - Merge schema extensions; support schema_headers and introspection fallback with timeout for remote schemas - Load schema and generate types once per build; read local schemas through BuildStep; use log instead of print - Propagate OperationException instead of returning null - Remove Awesome placeholder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Compile generated code with json_serializable + dart analyze and run it against a fake link (tagged `compile`) - Builder tests via build_test - Unit tests for document utils, naming, introspection-to-SDL, config - Update expectations for interfaces, unions, subscriptions, mutations Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Dart 3.2 pub resolves build_test 2.2.2, which rethrows builder exceptions instead of only logging them like 3.x does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ifmelate
added a commit
that referenced
this pull request
Oct 10, 2026
Codegen improvements: interfaces/unions, subscriptions, typed variables, builder fixes
ifmelate
added a commit
that referenced
this pull request
Oct 10, 2026
Codegen improvements: interfaces/unions, subscriptions, typed variables, builder fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Generated code for the project's own fixture schema did not compile before this change (86 analyzer errors, json_serializable failed on the
SearchResultunion). It now compiles with no errors or warnings in both nullability modes, and a new test runs it end to end.This branch is based on
feature/improve-filepath, which was never merged, so it also brings in those commits (1.0.2-rc.1 path handling, AST parser, strict nullability, deterministic output).Generator
fromJsondispatches on__typename, withUnknown*fallbacks.__typenameis added to generated documents.Streams viaGraphQLClient.subscribe. Before,SubscriptionOptionswere passed toquery, which did not compile..graphqlfiles.<Op>Resultclass instead of silently dropping fields.<Op>Variablesclasses withtoJson(), plus public<op>Documentandparse<Op>Data, usable withwatchQueryand any fetch policy.class→class_, enum valuedefault→default_), while the GraphQL name is still sent on the wire.extend type ...schema extensions are merged.Builder / schema loading
types.dartgenerated once per build instead of once per file.BuildStep, so editing the schema triggers a rebuild.schema.graphqlpath check, which skipped files likeget_schema.graphql. Schema files are now detected by their content.loginstead ofprint. build_runner reported everyprintas a warning.schema_headersoption with${ENV}expansion;Behaviour changes (see CHANGELOG)
*Datamethods throwOperationExceptioninstead of returningnullon errors.raw;valueis still a string.DateTimeConverter.toJson/LocalDateConverter.toJsonreturndynamic.Awesomeplaceholder is removed.Known limitation (not addressed)
Generated classes still mirror schema types, not selection sets. Parsing an object throws if the operation did not select one of its non-null fields. This is documented in the README. Fixing it needs selection-set types, which is a major version change.
Test plan
dart format --set-exit-if-changed .dart analyze --fatal-infos(was failing on master's base)dart test: 93 tests, including the newcompiletest that runs json_serializable plusdart analyzeon generated code and executes it against a fake link🤖 Generated with Claude Code