jspg error refactoring checkpoint
This commit is contained in:
@ -5,7 +5,9 @@ pub mod filter;
|
||||
pub mod polymorphism;
|
||||
|
||||
use crate::database::schema::Schema;
|
||||
use crate::drop::{Error, ErrorDetails};
|
||||
use indexmap::IndexMap;
|
||||
use std::collections::HashMap;
|
||||
|
||||
impl Schema {
|
||||
pub fn compile(
|
||||
@ -13,7 +15,7 @@ impl Schema {
|
||||
db: &crate::database::Database,
|
||||
root_id: &str,
|
||||
path: String,
|
||||
errors: &mut Vec<crate::drop::Error>,
|
||||
errors: &mut Vec<Error>,
|
||||
) {
|
||||
if self.obj.compiled_properties.get().is_some() {
|
||||
return;
|
||||
@ -72,13 +74,10 @@ impl Schema {
|
||||
}
|
||||
|
||||
if custom_type_count > 1 {
|
||||
errors.push(crate::drop::Error {
|
||||
errors.push(Error {
|
||||
code: "MULTIPLE_INHERITANCE_PROHIBITED".to_string(),
|
||||
message: format!(
|
||||
"Schema attempts to extend multiple custom object pointers in its type array {:?}. Use 'oneOf' for polymorphism and tagged unions.",
|
||||
types
|
||||
),
|
||||
details: crate::drop::ErrorDetails {
|
||||
values: Some(HashMap::from([("types".to_string(), types.join(", "))])),
|
||||
details: ErrorDetails {
|
||||
path: Some(path.clone()),
|
||||
schema: Some(root_id.to_string()),
|
||||
..Default::default()
|
||||
|
||||
Reference in New Issue
Block a user