fix(dart): reserve the MapEntry runtime name by schani · Pull Request #3475 · glideapps/quicktype · GitHub
Skip to content

fix(dart): reserve the MapEntry runtime name - #3475

Merged
schani merged 1 commit into
masterfrom
fix/dart-map-entry-name
Sep 6, 2026
Merged

fix(dart): reserve the MapEntry runtime name#3475
schani merged 1 commit into
masterfrom
fix/dart-map-entry-name

Conversation

@schani

@schani schani commented Sep 6, 2026

Copy link
Copy Markdown
Member

A JSON input with a MapEntry property makes quicktype emit a Dart class named MapEntry, shadowing dart:core's. The generated EnumValues<T> helper calls MapEntry(v, k), so the file fails to compile: TopLevel.dart:6504:52: Error: Too many positional arguments: 0 allowed, but 2 found. ... reverseMap = map.map((k, v) => MapEntry(v, k));. Reserving MapEntry in the Dart keyword list renames the model class instead.

Coverage: MapEntry added to test/keywords.txt, with test/inputs/json/priority/keywords.json, test/inputs/schema/keyword-enum.schema and test/inputs/schema/keyword-unions.schema regenerated by test/make-keyword-tests.sh. These are shared inputs, so all languages that run them now exercise the name.

Validation: npm run build; CPUs=2 QUICKTEST=true FIXTURE=dart npm run test:fixtures (68 tests, all Dart option variants); CPUs=2 QUICKTEST=true FIXTURE=schema-dart npm run test:fixtures -- test/inputs/schema/keyword-enum.schema test/inputs/schema/keyword-unions.schema; keywords.json through typescript, javascript, typescript-zod, typescript-effect-schema, swift, golang, rust, kotlin, kotlin-jackson, cplusplus, objective-c, php, elixir, elm, crystal, pike, flow, javascript-prop-types, python, ruby, csharp, java; npm run lint. Baseline without the constants.ts change reproduces the compile error above.

Production change: 1 line added, 0 removed.

🤖 Generated with Claude Code

A model class named MapEntry shadows dart:core's MapEntry, which the
generated EnumValues<T> helper uses, so the output does not compile.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

@schani
schani enabled auto-merge (squash) September 6, 2026 14:36
@schani
schani merged commit 99c6fdd into master Sep 6, 2026
35 checks passed
@schani
schani deleted the fix/dart-map-entry-name branch September 6, 2026 14:36
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