aws-amplify / aws-amplify/amplify-codegen

Datastore codegen created models don't respect Dart linting rules

Open
#510 6 comments 4 reactions 0 assignees View on GitHub
feature-request
Dominant language
TypeScript
Stars
59
Forks
64
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
CLI codegen models creates QueryFields that use uppercased variables.

Example:
`static final QueryField SESSIONID = QueryField(fieldName: "sessionID");`

They get picked up by the IDE as
`Name non-constant identifiers using lowerCamelCase.dart(non_constant_identifier_names)`

**To Reproduce**
Steps to reproduce the behavior:
1. Create a graphql schema
2. Run amplify codegen models
3. Scroll down to 'static final QueryField.'
4. See the IDE screaming for non_constant_identifier_names errors

**Expected behavior**
Respecting dart listing rules

**Platform**
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
[X] Android
[X] iOS

Amplify CLI version 4.45.2

Output of flutter doctor -v

```[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-arm, locale en-FR)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.54.3)
[✓] Connected device (3 available)```

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by creating a GraphQL schema and running amplify codegen models, then trace the codegen path that emits Dart QueryField identifiers. Done means generated model names follow Dart linting rules and no non_constant_identifier_names errors appear in the IDE.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, typescript
Domain
cli, mobile-dev, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.