Open
Description
Hi, for now ,the following example will generate 4 chapters with id =1 :
let book = vec![
Book {
id: "1".into(),
title: "The Fellowship of the Ring".into(),
first_chapter: Chapter {
id: "1".into(),
title: "A Long-expected Party".into(),
ordering: 1,
},
chapters: vec![Chapter {
id: "1".into(),
title: "A Long-expected Party".into(),
ordering: 1,
}],
},
Book {
id: "2".into(),
title: "The Fellowship of the Ring".into(),
first_chapter: Chapter {
id: "1".into(),
title: "A Long-expected Party".into(),
ordering: 1,
},
chapters: vec![Chapter {
id: "1".into(),
title: "A Long-expected Party".into(),
ordering: 1,
}],
},
];
let doc = vec_to_jsonapi_document(book);
dbg!(&doc);
assert!(doc.is_valid());
included: Some(
[
Resource {
_type: "chapters",
id: "1",
attributes: {
"ordering": Number(
1,
),
"title": String(
"A Long-expected Party",
),
},
relationships: None,
links: None,
meta: None,
},
Resource {
_type: "chapters",
id: "1",
attributes: {
"ordering": Number(
1,
),
"title": String(
"A Long-expected Party",
),
},
relationships: None,
links: None,
meta: None,
},
Resource {
_type: "chapters",
id: "1",
attributes: {
"ordering": Number(
1,
),
"title": String(
"A Long-expected Party",
),
},
relationships: None,
links: None,
meta: None,
},
Resource {
_type: "chapters",
id: "1",
attributes: {
"title": String(
"A Long-expected Party",
),
"ordering": Number(
1,
),
},
relationships: None,
links: None,
meta: None,
},
],
Should these chapters be deduplicated?
Metadata
Metadata
Assignees
Labels
No labels