@@ -106,13 +106,14 @@ const anyOfErrorHandler = async (normalizedErrors, instance, localization) => {
106106 alternativeProperties . add ( location ) ;
107107 }
108108 }
109+
109110 return alternativeProperties ;
110111 } ) ;
111112
112113 const discriminator = definedProperties . reduce ( ( acc , properties ) => {
113114 return acc . intersection ( properties ) ;
114115 } , definedProperties [ 0 ] ) ;
115- const discriminatedAlternatives = allAlternatives . filter ( ( alternative ) => {
116+ const discriminatedAlternatives = alternatives . filter ( ( alternative ) => {
116117 for ( const instanceLocation in alternative ) {
117118 if ( ! discriminator . has ( instanceLocation ) ) {
118119 continue ;
@@ -143,11 +144,10 @@ const anyOfErrorHandler = async (normalizedErrors, instance, localization) => {
143144 // Discriminator identified, but none of the alternatives match
144145 if ( discriminatedAlternatives . length === 0 ) {
145146 // TODO: How do we handle this case?
146- // errors.push(...await getErrors(allAlternatives[0], instance, localization));
147147 }
148148
149149 // 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
151151 const instanceProperties = new Set ( Instance . values ( instance )
152152 . map ( ( node ) => Instance . uri ( node ) ) ) ;
153153 let maxMatches = - 1 ;
0 commit comments