-
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Using direct resource imports to set the type in a relationship can produce a dependency cycle.
// book.ts
import Author from './author';
class Book extends Resource {
static schema = {
attributes: {
title: String;
},
relationships: {
authors: {
hasMany: true,
type: () => Author
}
}
}
}// author.ts
import Book from './book';
class Author extends Resource {
static schema = {
attributes: {
firstName: String;
lastName: String;
},
relationships: {
books: {
hasMany: true,
type: () => Book
}
}
}
}We might want to replace type: () => Resource with a string resolver to prevent this and use resourceFor() to resolve the type internally.
We can accept both syntaxes to prevent this from becoming a breaking change.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request