Skip to content

Commit

Permalink
feat: Support Amplify Android Lazy Types and Custom Selection Set (#699)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent 7f56174 commit 6e3de3c
Show file tree
Hide file tree
Showing 15 changed files with 8,670 additions and 261 deletions.
2 changes: 2 additions & 0 deletions packages/amplify-codegen/src/commands/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { validateAmplifyFlutterMinSupportedVersion } = require('../utils/validate
const defaultDirectiveDefinitions = require('../utils/defaultDirectiveDefinitions');
const getProjectRoot = require('../utils/getProjectRoot');
const { getModelSchemaPathParam, hasModelSchemaPathParam } = require('../utils/getModelSchemaPathParam');
const { isDataStoreEnabled } = require('graphql-transformer-core');

/**
* Amplify Context type.
Expand Down Expand Up @@ -260,6 +261,7 @@ async function generateModels(context, generateOptions = null) {
const generatedCode = await generateModelsHelper({
schema: loadSchema(apiResourcePath),
directives: await getDirectives(context, apiResourcePath),
isDataStoreEnabled: await isDataStoreEnabled(apiResourcePath),
target: modelgenFrontendToTargetMap[frontend],
generateIndexRules: readFeatureFlag(context, 'codegen.generateIndexRules'),
emitAuthProvider: readFeatureFlag(context, 'codegen.emitAuthProvider'),
Expand Down
1 change: 1 addition & 0 deletions packages/appsync-modelgen-plugin/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const addToSchema: (config: AppSyncModelPluginConfig) => string;
export type AppSyncModelCodeGenPresetConfig = {
overrideOutputDir: string | null;
target: Target;
isDataStoreEnabled?: boolean;
};

// @public (undocumented)
Expand Down
Loading

0 comments on commit 6e3de3c

Please sign in to comment.