immutable tri-state
This commit is contained in:
@ -180,9 +180,10 @@ impl<'a> ValidationContext<'a> {
|
||||
}
|
||||
|
||||
if !self.response {
|
||||
let is_external = self.db.executor.punc_external().unwrap_or(false);
|
||||
if let Some(compiled_props) = self.schema.compiled_properties.get() {
|
||||
for (key, sub_schema) in compiled_props {
|
||||
if sub_schema.is_immutable() && obj.contains_key(key) {
|
||||
if sub_schema.is_immutable(is_external) && obj.contains_key(key) {
|
||||
result.errors.push(ValidationError {
|
||||
code: "IMMUTABLE_PROPERTY_VIOLATION".to_string(),
|
||||
values: Some(IndexMap::from([
|
||||
@ -194,7 +195,7 @@ impl<'a> ValidationContext<'a> {
|
||||
}
|
||||
} else if let Some(props) = &self.schema.properties {
|
||||
for (key, sub_schema) in props {
|
||||
if sub_schema.is_immutable() && obj.contains_key(key) {
|
||||
if sub_schema.is_immutable(is_external) && obj.contains_key(key) {
|
||||
result.errors.push(ValidationError {
|
||||
code: "IMMUTABLE_PROPERTY_VIOLATION".to_string(),
|
||||
values: Some(IndexMap::from([
|
||||
@ -207,6 +208,8 @@ impl<'a> ValidationContext<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if let Some(props) = &self.schema.properties {
|
||||
for (key, sub_schema) in props {
|
||||
if self.overrides.contains(key) {
|
||||
|
||||
Reference in New Issue
Block a user