Skip to content

Is it possible for one property in a model to re-use the value of another? #157

Answered by kettanaito
wrex asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, @wrex. Thank you for raising this!

Currently, we don't have an API to allow referencing other properties of the same entity in the value getters. There's, however, a suggestion in #95. We would like to support this, so please share with us any ideas/suggestions on how you want this API to work in the said issue.

Ideally, I'd like to see an API like this:

factory({
  user: {
    id: primaryKey(...),
    url: (entity) => entity.id
  }
})

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wrex
Comment options

@kettanaito
Comment options

Answer selected by wrex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants