Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataStore codegen wrong message for union types #211

Closed
drochetti opened this issue Jun 16, 2020 · 6 comments
Closed

DataStore codegen wrong message for union types #211

drochetti opened this issue Jun 16, 2020 · 6 comments
Labels
feature-request New feature or request model-gen Issues on datastore model generation

Comments

@drochetti
Copy link

Describe the bug
When a union type is defined in the schema.graphql, an attempt to generate DataStore models fails with the following message:

Unknown type SearchResult for field items. Did you forget to add the @model directive

Amplify CLI Version
4.21.1

To Reproduce

  • Create a schema with a union type.
  • run amplify codegen models

Sample schema:

union SearchResult = Contact | User | Entity
type SearchableConnection {
  items: [SearchResult]
  nextToken: String
  total: Int
}

Expected behavior
A clear message stating that union types are not supported in DataStore.

Screenshots
N/A.

Desktop (please complete the following information):

  • OS: MacOS 10.14.6
  • Node Version: 12.8.0

Additional context
Reported originally by @lenarmazitov: aws-amplify/amplify-swift#544

@olivoil
Copy link

olivoil commented Jun 29, 2020

is there a plan to support union types?

would it be possible for datastore to ignore the declarations of union types instead of throwing an error? and have part of an API using union types without datastore, and still use datastore for things it supports?

@arealmaas
Copy link

arealmaas commented Apr 6, 2021

Bump? Having the same issue here. Added an issue in the codegen repo #143

Would be nice to atleast be able to use the union types even though it's not supported for datastore

@josefaidt
Copy link
Contributor

Hey yall 👋 thanks for raising this! I'll transfer to the codegen repo for better assistance

@josefaidt josefaidt transferred this issue from aws-amplify/amplify-cli Jul 29, 2021
@josefaidt josefaidt added the transferred Issue has been transferred from another Amplify repository label Jul 29, 2021
@phani-srikar phani-srikar added feature-request New feature or request model-gen Issues on datastore model generation and removed transferred Issue has been transferred from another Amplify repository labels Mar 29, 2022
@ucheNkadiCode
Copy link

Ca we please have an update on this? I think this is a pretty necessary part of GraphQL. Data store should seriously support unions.

@AndresPope
Copy link

There is an update about this topic??

Copy link

github-actions bot commented Jul 2, 2024

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request model-gen Issues on datastore model generation
Projects
None yet
Development

No branches or pull requests

8 participants