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: documentation/correctness.adoc
+9-7
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
= Model correctness
2
2
3
3
We can identify a number of separate criteria for the correctness of a model.
4
-
Failure to comply to one or more of these criteria doesn't imply incorrectness of the model.
4
+
Failure to comply to one or more of these criteria doesn't imply the model as a whole is completely incorrect.
5
5
Typically, it's quite possible to recover from such failures.
6
6
The criteria can be visualized as follows.
7
7
@@ -31,12 +31,14 @@ It's desirable to be able to recover from "`simple`"/"`obvious`" syntax errors i
31
31
32
32
Incorrectness is to be reported in terms of the location where parsing the JSON text failed, including an indication whether this was recoverable.
33
33
The reporting is typically dependent on the precise JSON parser used.
34
+
In particular, the JSON parser used might recover automatically, essentially ignoring syntax errors without reporting them in any way.
35
+
This could be problematic, e.g. in case of duplicate keys in an object: the JSON parser is most likely to only reproduce the last value for the duplicate key, ignoring the previous ones.
34
36
35
37
=== Structural syntactic
36
38
37
39
The JSON conforms to link:../schemas/serialization.schema.json[the JSON Schema for the serialization format]footnote:[This file should match link:https://github.com/LIonWeb-org/lioncore-typescript/blob/main/schemas/generic-serialization.schema.json[the one in the `lioncore-typescript` repository].].
38
40
The `serializationFormatVersion` property of the root object of the serialization indicates which version to use (or should do so).
39
-
Currently, there's only one version, which is identified as: `"1"` (i.e., a string containing the integer 1).
41
+
Currently, there's only one version, which is identified asa string such as `"2023.1"`.
40
42
41
43
Note that JSON Schema isn't powerful enough to express more high-level, nor constraints of a referential nature on the serialization chunk.
42
44
@@ -58,6 +60,7 @@ Concretely: if a node `N` is a child of a node `P` then `N.parent` should equal
58
60
Violation is to be reported in terms of the ID of the contain**ing** serialized node, the ID of the contain**ed** serialized node, and the `parent` ID stated by that.
59
61
. No duplicate containments, i.e. nodes are not the children of multiple other nodes, nor of themselves.
60
62
Violation is to be reported in terms of the ID of the duplicately-contained serialized node, and the IDs of all serialized nodes that claim to contain it, including the links by which this happens, as well the index in the value of those links.
63
+
. No containment cycles, i.e. nodes are not containing themselves.
61
64
. **TODO** extend for annotations
62
65
63
66
At this point, links (so: containments and references) don't need to resolve (yet).
@@ -68,10 +71,9 @@ If all links do resolve, we say the serialization chunk is _self-contained_.
68
71
69
72
=== Meta-referential
70
73
71
-
All the metamodels specified in the serialization chunk are _made available_ to the client('s deserializer) in a suitable form.
72
-
That would typically imply the presence of types or type definitions in some programming language.
74
+
All the metamodels specified in the serialization chunk should be _made available_ to the client('s deserializer) in the form of a runtime representation that the deserializer can reconstruct from the serializatino.
73
75
**Note** that this is a condition that pertains to the deserializing client, rather than on the serialization chunk.
74
-
Incorrectness could be partially recovered from by partially deserializing into "`dynamic`"/"`reflective`" nodes.
76
+
Incorrectness could be partially recovered from by partially deserializing into "`reflective`" nodes.
75
77
76
78
=== Meta-structural
77
79
@@ -87,7 +89,7 @@ Incorrectness is to be reported in terms of the ID of the serialized node, the f
87
89
Incorrectness is to be reported in terms of the ID of the serialized node, the feature type (property/containment/reference), the index of the offending entry, and the key which can not be resolved.
88
90
"`To resolve a key`" means that we can find a concept or feature in some metamodel with that key, and with (exactly-)matching version.
89
91
Incorrectness is to be reported as a model with references to nodes, as well as an appropriate error message.
90
-
Incorrectness could be partially recovered from by partially deserializing into "`dynamic`"/"`reflective`" nodes, leaving the unresolvable meta-references as-is.
92
+
Incorrectness could be partially recovered from by partially deserializing into "`reflective`" nodes, leaving the unresolvable meta-references as-is.
91
93
92
94
93
95
== Model (post-deserialization/in-memory)
@@ -97,7 +99,7 @@ Incorrectness could be partially recovered from by partially deserializing into
97
99
All links (on M1/instance-level) resolve.
98
100
Note that this doesn't require any knowledge of the metamodels, as it just involves nodes' IDs.
99
101
This means that the serialization chunk doesn't need to be correct in the meta-referential nor in the meta-structural sense!
100
-
It should be alway possible to deserialize the serialization chunk into "`dynamic`"/"`reflective`" nodes, which could be useful in its own right.
102
+
It should be alway possible to deserialize the serialization chunk into "`reflective`" nodes, which could be useful in its own right.
101
103
102
104
**TODO:** describe when and how links should be resolved, etc.
0 commit comments