immutable tri-state

This commit is contained in:
2026-08-03 12:03:03 -04:00
parent c071a959f7
commit c5e103c867
8 changed files with 149 additions and 8 deletions

View File

@ -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) {