@@ -294,9 +294,8 @@ export class AppSyncModelVisitor<
294294 }
295295 processDirectives ( ) {
296296 if ( this . config . usePipelinedTransformer || this . config . transformerVersion === 2 ) {
297- this . processConnectionDirectivesV2 ( )
298- }
299- else {
297+ this . processConnectionDirectivesV2 ( ) ;
298+ } else {
300299 this . processConnectionDirective ( ) ;
301300 }
302301 this . processAuthDirectives ( ) ;
@@ -441,9 +440,10 @@ export class AppSyncModelVisitor<
441440 const typeArr : any [ ] = [ ] ;
442441 Object . values ( { ...this . modelMap , ...this . nonModelMap } ) . forEach ( ( obj : CodeGenModel ) => {
443442 // include only key directive as we don't care about others for versioning
444- const directives = ( this . config . usePipelinedTransformer || this . config . transformerVersion === 2 )
445- ? obj . directives . filter ( dir => dir . name === 'primaryKey' || dir . name === 'index' )
446- : obj . directives . filter ( dir => dir . name === 'key' ) ;
443+ const directives =
444+ this . config . usePipelinedTransformer || this . config . transformerVersion === 2
445+ ? obj . directives . filter ( dir => dir . name === 'primaryKey' || dir . name === 'index' )
446+ : obj . directives . filter ( dir => dir . name === 'key' ) ;
447447 const fields = obj . fields
448448 . map ( ( field : CodeGenField ) => {
449449 // include only connection field and type
@@ -633,7 +633,7 @@ export class AppSyncModelVisitor<
633633 Object . values ( this . modelMap ) . forEach ( model => {
634634 model . fields . forEach ( field => {
635635 field . directives . forEach ( dir => {
636- if ( dir . name === 'manyToMany' ) {
636+ if ( dir . name === 'manyToMany' ) {
637637 let relationName = graphqlName ( toUpper ( dir . arguments . relationName ) ) ;
638638 let existingRelation = manyDirectiveMap . get ( relationName ) ;
639639 if ( existingRelation ) {
@@ -679,7 +679,7 @@ export class AppSyncModelVisitor<
679679 model . fields . forEach ( field => {
680680 const connectionInfo = processConnectionsV2 ( field , model , this . modelMap ) ;
681681 if ( connectionInfo ) {
682- if ( connectionInfo . kind === CodeGenConnectionType . HAS_MANY ) {
682+ if ( connectionInfo . kind === CodeGenConnectionType . HAS_MANY || connectionInfo . kind === CodeGenConnectionType . HAS_ONE ) {
683683 // Need to update the other side of the connection even if there is no connection directive
684684 addFieldToModel ( connectionInfo . connectedModel , connectionInfo . associatedWith ) ;
685685 } else if ( connectionInfo . targetName !== 'id' ) {
0 commit comments