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

On a given interface store which models implement it #2738

Conversation

penard-cb
Copy link
Contributor

@penard-cb penard-cb commented Jul 28, 2023

Describe your PR and link to any relevant issues.

On any given model we know of which interface it is. However there are cases where if you're writing some custom models, you would like to know what a type is implemented by:

For example:


type EntryCollection {
  total: Int!
  skip: Int!
  limit: Int!
  items: [Entry]!
}

interface Entry {
  sys: Sys!
  metadata: metadata!
} 

type Page implements Entry {
  sys: Sys!
  metadata: metadata!
  linkedFrom(allowedLocales: [String]): PageLinkingCollections
  name(locale: String): String
  ...
}
type PageArticle implements Entry {
  sys: Sys!
  metadata: metadata!
  linkedFrom(allowedLocales: [String]): PageArticleLinkingCollections
  name(locale: String): String
  ...
}

For a Page and a PageArticle we'll know it implements Entry. But if we want to add additional model functionality for an interface, we don't know all the types that implement it. This PR makes it possible to add complex model definitions and helpers (marshalers/unmarshalers) for the Entry type.

@coveralls
Copy link

coveralls commented Jul 28, 2023

Coverage Status

coverage: 75.766% (+0.02%) from 75.75% when pulling cf5f468 on penard-cb:feat/add-model-object-reference-to-interface into 0eb95dc on 99designs:master.

@StevenACoffman
Copy link
Collaborator

Thanks! I'm loving these improvements!

@StevenACoffman StevenACoffman merged commit 2d8673a into 99designs:master Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants