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
issues.AddError(fmt.Sprintf("\"%s\" should have an attribute \"@type\": \"http://mlcommons.org/croissant/Field\". Got %s instead.", field.Name, field.Type), field)
258
262
}
259
263
264
+
// More explicit dataType validation
260
265
iffield.DataType.GetFirstType() =="" {
261
-
issues.AddError("The field does not specify a valid http://mlcommons.org/croissant/dataType, neither does any of its predecessor.", field)
266
+
issues.AddError(fmt.Sprintf("Field \"%s\" is missing required \"dataType\" property.", field.Name), field)
// Only validate source for leaf fields (fields without subfields)
286
+
if!hasSubFields {
287
+
// Check if source is properly configured
288
+
if!hasValidFieldSource(field) {
289
+
issues.AddError(fmt.Sprintf("Field \"%s\" has invalid or missing source configuration.", field.Name), field)
275
290
}
276
291
}
277
292
278
-
if!field.Source.ValidateSource() {
279
-
issues.AddError(fmt.Sprintf("Node \"%s\" is a field and has no source. Please, use http://mlcommons.org/croissant/source to specify the source.", field.ID), field)
293
+
// Validate subfields recursively
294
+
iffield.SubField!=nil {
295
+
for_, subField:=rangefield.SubField {
296
+
ifsubField!=nil {
297
+
subField.SetParent(field)
298
+
ValidateFieldNode(subField, issues, options)
299
+
}
300
+
}
280
301
}
281
302
}
282
303
304
+
// hasValidFieldSource checks if a field node has valid source configuration
305
+
funchasValidFieldSource(field*FieldNode) bool {
306
+
iffield==nil {
307
+
returnfalse
308
+
}
309
+
310
+
// Check if the source has file object reference and extraction method
311
+
hasFileObject:=field.Source.FileObject.ID!=""
312
+
hasExtract:=field.Source.Extract.Column!=""||
313
+
field.Source.Extract.JSONPath!=""||
314
+
field.Source.Extract.FileProperty!=""||
315
+
field.Source.Extract.Regex!=""
316
+
hasFormat:=field.Source.Format!=""
317
+
318
+
// A valid source needs either a file object reference with extraction info, or format
319
+
returnhasFileObject&& (hasExtract||hasFormat)
320
+
}
321
+
283
322
// ValidateCrossReferences validates that all references are valid
0 commit comments