@@ -1057,6 +1057,46 @@ <h2>The <dfn>InteractionOutput</dfn> interface</h2>
1057
1057
< section > < h3 > The < dfn > check data schema</ dfn > algorithm</ h3 >
1058
1058
To run the < a > check data schema</ a > steps on |payload| and |schema:object|,
1059
1059
< ol >
1060
+ < li >
1061
+ If |schema| is `null` or `undefined`, return `undefined`.
1062
+ </ li >
1063
+ < li >
1064
+ <!--
1065
+ TODO: Should we just continue with the rest of the algorithm here?
1066
+ -->
1067
+ If |schema|.|default| is not |undefined| and |payload| is undefined,
1068
+ let |payload| be the value of |schema|.|default|.
1069
+ </ li >
1070
+ < li >
1071
+ Let |const| be |schema|.|const|.
1072
+ If |const| is not |undefined|,
1073
+ < ol >
1074
+ < li >
1075
+ <!-- TODO: Should we already return here? -->
1076
+ If |const| equals |payload|, return |payload|.
1077
+ </ li >
1078
+ < li >
1079
+ If |const| does not equal |payload|, throw {{TypeError}} and stop.
1080
+ </ li >
1081
+ </ ol >
1082
+ </ li >
1083
+ < li >
1084
+ If |schema|.|enum| is not |undefined| and none of the elements in
1085
+ |schema|.|enum| equal |payload|, throw {{TypeError}} and stop.
1086
+ </ li >
1087
+ < li >
1088
+ Let |oneOf| be |schema|.|oneOf|.
1089
+ If |oneOf| is not |undefined|,
1090
+ < ol >
1091
+ < li >
1092
+ For each |subSchema| in |oneOf|, run the < a > check data schema</ a >
1093
+ steps on |payload| and |subSchema|.
1094
+ </ li >
1095
+ < li >
1096
+ If all of these runs throw, throw {{TypeError}} and stop.
1097
+ </ li >
1098
+ </ ol >
1099
+ </ li >
1060
1100
< li >
1061
1101
Let |type| be |schema|.|type|.
1062
1102
</ li >
0 commit comments