Skip to content

Schema docs, unknown enum fallback, duplicate operation checks - #3

Merged
ifmelate merged 3 commits into
masterfrom
feature/quick-fixes
Oct 17, 2026
Merged

ifmelate merged 3 commits into
masterfrom
feature/quick-fixes

Conversation

@ifmelate

Copy link
Copy Markdown
Owner

Non-breaking improvements for 2.1.0.

Added

  • Schema descriptions become doc comments on classes, fields, enums and enum values; @deprecated is noted there as Deprecated: <reason>
  • deprecated_annotations option: emit Dart @Deprecated (opt-in, because json_serializable's types.g.dart then triggers deprecated_member_use_from_same_package, which fails flutter analyze)
  • unknown_enum_fallback option: enums get a $unknown value that unknown server values parse to, also in lists (opt-in, because the extra value makes existing exhaustive switches incomplete)
  • BLD104: duplicate operation names in one document, across documents, or names mapping to the same output file. Operation files record their source in a // Source: line, so regenerating or moving an operation doesn't trigger false positives
  • Unknown keys in graphql_codegen.yaml are logged as warnings with a "did you mean" suggestion

Fixed

  • Lists of enums with escaped values ([Role!] containing default) failed to parse, because json_serializable's enum map only knew the Dart names. Escaped values now carry @JsonValue
  • The index.dart usage hint showed an invalid package:your_app/lib/... import

Deprecated

  • Public helpers the generator no longer uses; removal planned for 3.0 (listed in CHANGELOG)

Tests

  • 116 tests (was 92). The compile test now also fails on analyzer infos/warnings in generated files and runs a second variant with both new options enabled

- Schema descriptions become doc comments; @deprecated is noted there, and
  becomes a Dart @deprecated with the new deprecated_annotations option
- unknown_enum_fallback option adds a $unknown value that unknown server
  values parse to (also in lists) instead of throwing
- BLD104 for duplicate operation names within or across documents and for
  names mapping to the same output file; operation files record their source
- Unknown config keys are logged as warnings with a suggestion
- Fix: enum lists with escaped values (e.g. `default`) failed to parse;
  escaped values now carry @jsonvalue
- Fix: index.dart usage hint shows the real package: URI
- Deprecate public helpers the generator no longer uses (removal in 3.0)
- Compile test fails on analyzer infos/warnings in generated code
@ifmelate
ifmelate merged commit 609484a into master Oct 17, 2026
2 checks passed
@ifmelate ifmelate mentioned this pull request Oct 17, 2026
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