@@ -106,13 +106,14 @@ const anyOfErrorHandler = async (normalizedErrors, instance, localization) => {
106
106
alternativeProperties . add ( location ) ;
107
107
}
108
108
}
109
+
109
110
return alternativeProperties ;
110
111
} ) ;
111
112
112
113
const discriminator = definedProperties . reduce ( ( acc , properties ) => {
113
114
return acc . intersection ( properties ) ;
114
115
} , definedProperties [ 0 ] ) ;
115
- const discriminatedAlternatives = allAlternatives . filter ( ( alternative ) => {
116
+ const discriminatedAlternatives = alternatives . filter ( ( alternative ) => {
116
117
for ( const instanceLocation in alternative ) {
117
118
if ( ! discriminator . has ( instanceLocation ) ) {
118
119
continue ;
@@ -143,11 +144,10 @@ const anyOfErrorHandler = async (normalizedErrors, instance, localization) => {
143
144
// Discriminator identified, but none of the alternatives match
144
145
if ( discriminatedAlternatives . length === 0 ) {
145
146
// TODO: How do we handle this case?
146
- // errors.push(...await getErrors(allAlternatives[0], instance, localization));
147
147
}
148
148
149
149
// Last resort, select the alternative with the most properties matching the instance
150
- // TODO: We shouldn't use this strategy if alternatives have the same number of matching instances "UPDATED"
150
+ // TODO: We shouldn't use this strategy if alternatives have the same number of matching instances
151
151
const instanceProperties = new Set ( Instance . values ( instance )
152
152
. map ( ( node ) => Instance . uri ( node ) ) ) ;
153
153
let maxMatches = - 1 ;
0 commit comments