File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,14 +206,17 @@ def validate_references
206206 # subscribe[Exec[subscribe target 2]]
207207 # ---
208208 formatted_references = missing . map do |obj |
209- # obj[:target_value] can be a string or an array. If it's an array, break apart the
210- # array and create one error message per element.
209+ # obj[:target_value] can be a string or an array. If it's an array, create a
210+ # separate error message per element of that array. This allows the total number
211+ # of errors to be correct.
211212 src = "#{ obj [ :source ] [ 'type' ] . downcase } [#{ obj [ :source ] [ 'title' ] } ]"
212- tgv = obj [ :target_value ] . is_a? ( Array ) ? obj [ :target_value ] : [ obj [ :target_value ] ]
213- tgv . map { |tv | "#{ src } -> #{ obj [ :target_type ] . downcase } [#{ tv } ]" } . join ( '; ' )
213+ target_val = obj [ :target_value ] . is_a? ( Array ) ? obj [ :target_value ] : [ obj [ :target_value ] ]
214+ target_val . map { |tv | "#{ src } -> #{ obj [ :target_type ] . downcase } [#{ tv } ]" }
214215 end
215- plural = missing . size == 1 ? '' : 's'
216- raise ReferenceValidationError , "Catalog has broken reference#{ plural } : #{ formatted_references . join ( '; ' ) } "
216+ formatted_references . flatten!
217+ plural = formatted_references . size == 1 ? '' : 's'
218+ errors = formatted_references . join ( '; ' )
219+ raise ReferenceValidationError , "Catalog has broken reference#{ plural } : #{ errors } "
217220 end
218221
219222 private
You can’t perform that action at this time.
0 commit comments