You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/2020-12/meta-data/readOnly.markdown
+67-47Lines changed: 67 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,82 +28,102 @@ related:
28
28
keyword: deprecated
29
29
---
30
30
31
-
The `readOnly` keyword is used to indicate that the value of a particular property is managed exclusively by the owning authority, and attempts by an application to modify the value of this property are expected to be ignored or rejected by that authority. It essentially means that the instance value should not be modified.
31
+
The `readOnly` keyword, when set to `true`, signifies that an instance value
32
+
(such as a specific object property) cannot be modified or removed, whatever
33
+
that means in the context of the system. For example, form generators may rely
34
+
on this keyword to mark the corresponding input as read only. This keyword does
35
+
not affect validation, but the evaluator will collect its value as an
36
+
annotation.
32
37
33
-
It's important to note that this keyword doesn't imply the schema itself is writable; schemas must be treated as immutable. Instead, the keyword specifies instances where read/write operation semantics are use case specific.
38
+
{{<best-practice>}}
34
39
35
-
*`readOnly` does not affect data validation but serves as an informative annotation.
40
+
Avoid setting this keyword to the default value `false`. If an instance value
41
+
is not considered to be read only, the best practice is to omit the use of this
42
+
keyword altogether. This prevents unnecessarily generating and collecting an
43
+
annotation that does not carry any additional meaning.
36
44
37
-
## Examples
45
+
Also avoid simultaneously setting this keyword and the [`writeOnly`]({{< ref
46
+
"2020-12/meta-data/writeonly" >}}) keyword to `true` for the same instance
0 commit comments