Skip to content

Commit 6e3de3c

Browse files
tylerjroachlawmichaDane Pilcher
authored
feat: Support Amplify Android Lazy Types and Custom Selection Set (#699)
* Android CSS and LL support * Further model updates * Fix LazyModel generation logic * Only generate ModelPath if model type * lint * Fix LazyModel in builder * android lazy + css support * android updates * Add nullability requirements to CopyOfBuilder * Update to use ModelReference types * Adding tests (#697) * lint * generate CompositePKParent files correctly * WIP: attempt to check if datastore is enabled * Generate lazy if datastore is disbled * Fix indentation * PR Comments * add isDataStoreEnabled true tests * lint * Update tests * Add targetNames to belongsTo * Create manyToMany join model path files * Update API.md * add more test cases * refactor join model preset code * PR comment * pr comment * Fix unnecessary forEach iterations * Update packages/appsync-modelgen-plugin/src/visitors/appsync-java-visitor.ts Co-authored-by: Dane Pilcher <[email protected]> * Only add targetNames for HasOne on Android if lazy load support enabled --------- Co-authored-by: Michael Law <[email protected]> Co-authored-by: Dane Pilcher <[email protected]>
1 parent 7f56174 commit 6e3de3c

File tree

15 files changed

+8670
-261
lines changed

15 files changed

+8670
-261
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const { validateAmplifyFlutterMinSupportedVersion } = require('../utils/validate
77
const defaultDirectiveDefinitions = require('../utils/defaultDirectiveDefinitions');
88
const getProjectRoot = require('../utils/getProjectRoot');
99
const { getModelSchemaPathParam, hasModelSchemaPathParam } = require('../utils/getModelSchemaPathParam');
10+
const { isDataStoreEnabled } = require('graphql-transformer-core');
1011

1112
/**
1213
* Amplify Context type.
@@ -260,6 +261,7 @@ async function generateModels(context, generateOptions = null) {
260261
const generatedCode = await generateModelsHelper({
261262
schema: loadSchema(apiResourcePath),
262263
directives: await getDirectives(context, apiResourcePath),
264+
isDataStoreEnabled: await isDataStoreEnabled(apiResourcePath),
263265
target: modelgenFrontendToTargetMap[frontend],
264266
generateIndexRules: readFeatureFlag(context, 'codegen.generateIndexRules'),
265267
emitAuthProvider: readFeatureFlag(context, 'codegen.emitAuthProvider'),

packages/appsync-modelgen-plugin/API.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const addToSchema: (config: AppSyncModelPluginConfig) => string;
1616
export type AppSyncModelCodeGenPresetConfig = {
1717
overrideOutputDir: string | null;
1818
target: Target;
19+
isDataStoreEnabled?: boolean;
1920
};
2021

2122
// @public (undocumented)

0 commit comments

Comments
 (0)