immutable tri-state
This commit is contained in:
@ -888,7 +888,7 @@
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"immutable": true
|
||||
"immutable": "always"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -899,7 +899,7 @@
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"immutable": true
|
||||
"immutable": "always"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -945,5 +945,70 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"description": "immutable external vs always property validation",
|
||||
"database": {
|
||||
"types": [
|
||||
{
|
||||
"name": "invoice",
|
||||
"schemas": {
|
||||
"save_invoice.request": {
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"immutable": "external"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"immutable": "always"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"tests": [
|
||||
{
|
||||
"description": "immutable external property in request context allowed when internal (punc.external = false)",
|
||||
"data": {
|
||||
"id": "123",
|
||||
"status": "paid"
|
||||
},
|
||||
"schema_id": "save_invoice.request",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"description": "immutable always property in request context rejected even when internal (punc.external = false)",
|
||||
"data": {
|
||||
"id": "123",
|
||||
"created_at": "2026-07-21T00:00:00Z"
|
||||
},
|
||||
"schema_id": "save_invoice.request",
|
||||
"action": "validate",
|
||||
"expect": {
|
||||
"success": false,
|
||||
"errors": [
|
||||
{
|
||||
"code": "IMMUTABLE_PROPERTY_VIOLATION",
|
||||
"values": {
|
||||
"property_name": "created_at"
|
||||
},
|
||||
"details": {
|
||||
"path": "created_at",
|
||||
"schema": "save_invoice.request"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user