review the internal schema to allow to create schema without identifier; fix #513

This commit is contained in:
qdequele 2020-03-05 18:29:10 +01:00
parent 16a99aa95e
commit 86c3482cbd
No known key found for this signature in database
GPG key ID: B3F0A000EBF11745
11 changed files with 312 additions and 129 deletions

View file

@ -115,7 +115,7 @@ pub fn apply_documents_addition<'a, 'b>(
None => return Err(Error::SchemaMissing),
};
let identifier = schema.identifier();
let identifier = schema.identifier().ok_or(Error::MissingIdentifier)?;
// 1. store documents ids for future deletion
for document in addition {
@ -184,7 +184,7 @@ pub fn apply_documents_partial_addition<'a, 'b>(
None => return Err(Error::SchemaMissing),
};
let identifier = schema.identifier();
let identifier = schema.identifier().ok_or(Error::MissingIdentifier)?;
// 1. store documents ids for future deletion
for mut document in addition {

View file

@ -40,7 +40,7 @@ impl DocumentsDeletion {
where
D: serde::Serialize,
{
let identifier = schema.identifier();
let identifier = schema.identifier().ok_or(Error::MissingIdentifier)?;
let document_id = match extract_document_id(&identifier, &document)? {
Some(id) => id,
None => return Err(Error::MissingDocumentId),