Closed Anngeluss closed 5 years ago
Hi @Anngeluss ,
Hi @Anngeluss ,
- can you reference to that specification point?
- can you put al full POST example? (you just put a relationship)
Hi Pablo How can disable cache support
I also used the following configuration in in my App Module but still cache is working any help will be appreciated
NgxJsonapiModule.forRoot({ url: 'http://localhost:3000/', cache_prerequests: false, cachestore_support: false })
Hello @pablorsk,
- can you reference to that specification point?
Members of the relationships object (“relationships”) represent references from the resource object in which it’s defined to other resource objects : https://jsonapi.org/format/#document-resource-object-relationships
So the name of the relationship can be different from the type of the resource since it is defined according to its context. If I request articles, I need a "author" relationship that is of "people" type
- can you put al full POST example? (you just put a relationship)
The example is directly on the standard json api : https://jsonapi.org/
Thank you
Hi @Anngeluss ! Following with this example, you can use a different relationship name by adding the corresponding relationship in the Article
resource and typing it as a People
document collection (to take advantage of typescript):
export class Article {
public attibutes = {
title: ' '
}
public relationships = {
authors: new DocumentCollection<People>()
}
}
This way, the library will use the relationship alias authors
to display a collection of resources of type people
. You can access this collection at article.relationships.authors.data
.
Remember that PeopleService
must be registered before making a request to the API (in case that you are using lazy loaded modules).
Sorry... I've just realized that it fails when saving... working on it!
Solved in #171
According to the Jsonapi standard, it is possible to have the following structure :
For trying, relationships are not filled at the property "data" because aggregation of data is done on type recognition in relationships. In the example above, he looks for relationship ["people"] But the type should be search within the relationships relationship["author].data.type === "people"
NB: please excuse my English mistakes.