Skip to content

(aws-cdk/aws-appsync): Union type definition fields suffixed with "id" #17771

@fab-mindflow

Description

@fab-mindflow

What is the problem?

Union type definition is generated with a weird "id" suffix. Maybe there is a reason?

this.definition[options.field?.toString() + 'id'] = options.field;

Consequently, some of our union type are generated in GraphQL (as we have an advanced code first pre-processing using CDK AppSync) like this:

input UpdatePayloadInput {
  Type1id: Type1Input
  Type2id: Type2Input
}

Reproduction Steps

Build a Union type:

    const TypeUnion = new appsync.UnionType("TypeUnion", {
      definition: [
        Type1,
        Type2,
      ],
    })


   console.log(TypeUnion.definition)

This gives out:

{
  Type1id: GraphqlType {
    type: 'INTERMEDIATE',
    // ...
    }
  },
  Type2id: GraphqlType {
    type: 'INTERMEDIATE',
    // ...
    }
  }
}

What did you expect to happen?

Definition does not contain the "id" suffix.

What actually happened?

"id" is appended to the union type definition.

CDK CLI Version

1.134.0

Framework Version

No response

Node.js Version

16.13.0

OS

macOS 12.0.1 (Monterey)

Language

Typescript

Language Version

4.4.3

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-appsyncRelated to AWS AppSyncbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions