Skip to content

Commit 4e724fe

Browse files
AaronZyLeeHuiSFDane Pilcherphani-srikarTravis Sheppard
authored
feat(modelgen):custom pk support for all platforms (#427)
* feat(modelgen):custom pk support for all platforms * feat(modelgen): connected model support for custom pk (#430) * feat(modelgen): connected model support for custom pk * remove additional code * remove additional code * use neat statements for targetName * fix: manyToMany pk issue * fix: distinguish between option id and custom id * feat: add associateWithFields and model fk fields * fix: adding fields in belongsTo * feat: add associatedWithFields to support CPK * fix lint error * fix: rm error for fields in belongsTo * fix: rewrite toCamelCase, manyToMany and belongsTo process * feat: refactor hasOne process * feat: add PK/SK original field respect * fix: move constants and remove id type error * fix: refactor get connected fields for hasOne and belongsTo * add unit tests for connected fields refactor * fix: import * address CRs * fix: change pk naming in manyToMany models (#455) * address CRs * feat(modelgen-java): custom PK support for android (#422) * fix: remove id generation when custom pk is defined * add primary key class generation * add model config * add import for model primary key * add resolveIdentifier and pk class field * use outer class for pk class * fix: lgtm alert * address feedback * move pk class to nested one * rename primary key to identifier * feat: add target names for hasone/belongsTo * update snapshot * fix lint issue * fix: change version from string to int * always generate targetName field * fix: add fk fields in models * feat: add hasmany cpk support * fix: snapshot * fix: hasOne associateWith issue * fix: add PK field type respect * fix: apply feature flag to CPK java code * fix lint * fix: snapshots * fix: pre-define booleans for backward compatability * change ff condition * feat(modelgen-swift): custom primary key support for ios (#425) * fix: remove id generation when custom pk is defined * feat: add custom pk support for ios * fix snapshots * add empty line * fix: pk related fields to immutable * feat: add target names in hasOne/belongsTo model * rm additional parenthesis * feat: add hasMany connected model CPK support * fix: snapshot * fix: hasOne asscociate with key * fix: update ff name * fix: use feature flag for swift CPK * fix: snapshot * fix lint * add ff check * feat(modelgen-js): custom primary key support (#389) * Revert "fix: revert custom pk change (#376)" This reverts commit fa4fe52. * feat: change model meta generation in models * feat: add useCustomPrimaryKey ff * fix: rm unused import * rebase master * fix: add composite identifier type * fix: use codegen field for sortKeyField * fix: change ff name and set to true for test purpose * fix: composite key for id with sk * add targetNames in schema * add target name fields in model * add associateWithFields meta for hasOne relation * feat: add hasMany CPK support * fix: additional fiels in hasmany belongsTo * fix: associate with key issue * fix: use iscustomPK enabled * fix: update PK field respect * fix: meta snap * feat(modelgen-dart): custom pk support for flutter (#428) * feat(appsync-dart-visitor): attach index info to model schema (#391) * Chore/custom pk flutter (#393) * Revert "fix: revert custom pk change (#376)" This reverts commit fa4fe52. * feat: change model meta generation in models * feat: add useCustomPrimaryKey ff * fix: rm unused import * rebase master Co-authored-by: Zeyu Li <[email protected]> * Feat/custom pk flutter impl (#394) * fix(appsync-dart-visitor): update broken test snapshot * chore(appsync-dart-visitor): improve indexes generate following Dart lint rules * feat(appsync-dart-visitor): generate custom PK supporting code * Make custom PK fields immutable in copyWidth function * Improve ModelIdentifier methods implementation * Use the feature flag to control custom PK impl generation * udpate snapshot for updated dart comment blocks * Improve generated model identifier helper class * Update existing unit test snapshots and add new tests for custom PK * Remove unnecesary new initiating instances * revert comment block changes * Update the impl getting identifier fields * Revert "Remove unnecesary new initiating instances" This reverts commit 38927cb. * Remove trash code... * Add method override annotation (#402) * Custom pk flutter merge main (#407) * feat: update imports generated for flutter datastore plugin dependency (#382) (#388) * chore(amplify-codegen): change flutter import path from datastore to core (#380) * feat(appsync-modelgen-plugin): Change flutter datastore models dependency to use amplify_core * feat(appsync-modelgen-plugin): add amplify_flutter version check to determine datastore dependency import * fix(appsync-modelgen-plugin): correct indentation for error message * fix(appsync-modelgen-plugin): run linter * fix(amplify-codegen): update unit tests * fix(amplify-codegen): lower minimum version to 0.4.0-rc.1 * fix(appsync-modelgen-plugin): remove duplicate .dart from imports Co-authored-by: Travis Sheppard <[email protected]> Co-authored-by: Dane Pilcher <[email protected]> Co-authored-by: Phani Srikar Edupuganti <[email protected]> Co-authored-by: Travis Sheppard <[email protected]> * chore(release): Publish [ci skip] - [email protected] - @aws-amplify/[email protected] * feat: add null type union to optional fields * chore(release): Publish [ci skip] - [email protected] - @aws-amplify/[email protected] * fix(appsync-dart-visitor): update ignored linter rules (#404) * fix(appsync-dart-visitor): update ignored linter rules * Dedupe * fix unit tests snapshot Co-authored-by: Dane Pilcher <[email protected]> Co-authored-by: Phani Srikar Edupuganti <[email protected]> Co-authored-by: Travis Sheppard <[email protected]> Co-authored-by: phani-srikar <[email protected]> Co-authored-by: yeung-wah <[email protected]> * rm unrelated changes * fix: unit tests for non model * feat: add custom pk connected model support for belongsTo * fix: lint error * lgtm error * fix snapshot after rebase * feat: add support for hasMany CPK * fix: snapshots * fix: hasone associate with key * fix: add PK field type respect * feat(appsync-dart-visitor): capability of creating query predicate wi… (#441) * feat(appsync-dart-visitor): capability of creating query predicate with custom PK * wrap the code generation with the feature flag * fix: snapshots * fix: change unit test Co-authored-by: Hui Zhao <[email protected]> Co-authored-by: Dane Pilcher <[email protected]> Co-authored-by: Phani Srikar Edupuganti <[email protected]> Co-authored-by: Travis Sheppard <[email protected]> Co-authored-by: phani-srikar <[email protected]> Co-authored-by: yeung-wah <[email protected]> * fix: use read ff to replace hardcode Co-authored-by: Hui Zhao <[email protected]> Co-authored-by: Dane Pilcher <[email protected]> Co-authored-by: Phani Srikar Edupuganti <[email protected]> Co-authored-by: Travis Sheppard <[email protected]> Co-authored-by: phani-srikar <[email protected]> Co-authored-by: yeung-wah <[email protected]>
1 parent 876e557 commit 4e724fe

36 files changed

+10229
-1212
lines changed

packages/amplify-codegen/src/commands/models.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ async function generateModels(context) {
8484
const emitAuthProvider = readFeatureFlag('codegen.emitAuthProvider');
8585
const usePipelinedTransformer = readFeatureFlag('graphQLTransformer.useExperimentalPipelinedTransformer')
8686
const transformerVersion = readNumericFeatureFlag('graphQLTransformer.transformerVersion');
87+
const respectPrimaryKeyAttributesOnConnectionField = readFeatureFlag('graphQLTransformer.respectPrimaryKeyAttributesOnConnectionField');
8788

8889
let isTimestampFieldsAdded = readFeatureFlag('codegen.addTimestampFields');
8990
let enableDartNullSafety = readFeatureFlag('codegen.enableDartNullSafety');
@@ -125,7 +126,8 @@ async function generateModels(context) {
125126
usePipelinedTransformer,
126127
enableDartZeroThreeFeatures,
127128
transformerVersion,
128-
dartUpdateAmplifyCoreDependency
129+
dartUpdateAmplifyCoreDependency,
130+
respectPrimaryKeyAttributesOnConnectionField,
129131
},
130132
});
131133

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { toCamelCase } from "../../utils/fieldUtils";
2+
3+
describe('Field util function tests', () => {
4+
describe('toCamelCase test', () => {
5+
it('should construct the string array to a camel case phrase', () => {
6+
const words: string[] = ['AMPlify', 'data', 'build', 'time'];
7+
expect(toCamelCase(words)).toBe('aMPlifyDataBuildTime');
8+
});
9+
});
10+
});

0 commit comments

Comments
 (0)