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

[feature request] Add join table identification to the introspection schema #543

Open
4 tasks done
hein-j opened this issue Feb 17, 2023 · 0 comments
Open
4 tasks done
Labels
feature-request New feature or request

Comments

@hein-j
Copy link

hein-j commented Feb 17, 2023

Before opening, please confirm:

  • I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
  • I have searched for duplicate or closed issues.
  • I have read the guide for submitting bug reports.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.

How did you install the Amplify CLI?

No response

If applicable, what version of Node.js are you using?

No response

Amplify CLI Version

10.7.3

What operating system are you using?

Mac

Amplify Codegen Command

other codegen <subcommand> (please mention in the issue)

Describe the bug

This is a feature request

Currently, there is no 100% sure way of telling whether a model is a join table from the introspection schema.

Definition of "join table" here:
Given the schema:

type User @model {
  id: ID!
  Entries: [Entry] @hasMany(indexName: "byUser", fields: ["id"])
  Images: [Image] @hasMany(indexName: "byUser", fields: ["id"])
  Dogs: [Dog] @manyToMany(relationName: "UserDog")
}

type Entry @model  {
  id: ID!
  userID: ID! @index(name: "byUser")
  User: User @belongsTo(fields: ["userID"])
  Images: [Image] @hasMany(indexName: "byEntry", fields: ["id"])
}

type Image @model {
  id: ID!
  userID: ID! @index(name: "byUser")
  entryID: ID! @index(name: "byEntry")
  User: User! @belongsTo(fields: ["userID"])
  Entry: Entry! @belongsTo(fields: ["entryID"])
}

type Dog @model {
  Users: [User] @manyToMany(relationName: "UserDog")
}

UserDog should be identified as a join table and Image should not be.

Expected behavior

Request:
In the schema produced by running amplify codegen model-introspection --output-dir example...

  1. Mark join table models with a property like isJoinTable: true
  2. Add an identification to the model introspection schema so that it can be distinguished from a) the MIPR and b) previous versions of itself. Example: isIntrospection: true, version: 1.1.0 (or does the version field there currently already serve as this indicator?)

Reproduction steps

N/A

GraphQL schema(s)

No response

Log output

No response

Additional information

No response

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
Projects
None yet
Development

No branches or pull requests

1 participant