Skip to content

Commit c1e4e73

Browse files
committed
Adds keyword to result
1 parent 7924878 commit c1e4e73

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

gbfs-validator-java-api/src/main/java/org/entur/gbfs/validator/api/handler/ValidateApiDelegateHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ private List<FileError> mapFileErrors(List<FileValidationError> errors) {
136136
mapped.setInstancePath(error.violationPath());
137137
mapped.setSchemaPath(error.schemaPath());
138138
//mapped.setParams(error.); // TODO no source?
139-
//mapped.setKeyword(error.); // TODO get from source
139+
mapped.setKeyword(error.keyword());
140140
return mapped;
141141
}).toList();
142142
}

gbfs-validator-java/src/main/java/org/entur/gbfs/validation/model/FileValidationError.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,17 @@
2929
public record FileValidationError(
3030
String schemaPath,
3131
String violationPath,
32-
String message
32+
String message,
33+
String keyword
3334
) implements ValidationResultComponentIdentity<FileValidationError> {
3435

35-
@Override
36-
public String toString() {
37-
return "ValidationError{" +
38-
"schemaPath='" + schemaPath + '\'' +
39-
", violationPath='" + violationPath + '\'' +
40-
", message='" + message + '\'' +
41-
'}';
42-
}
43-
4436
@Override
4537
public boolean sameAs(FileValidationError other) {
4638
if (other == null) return false;
4739
if (!Objects.equals(schemaPath, other.schemaPath)) return false;
4840
if (!Objects.equals(violationPath, other.violationPath))
4941
return false;
50-
return Objects.equals(message, other.message);
42+
if (!Objects.equals(message, other.message)) return false;
43+
return Objects.equals(keyword, other.keyword);
5144
}
5245
}

gbfs-validator-java/src/main/java/org/entur/gbfs/validation/validator/FileValidator.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ List<FileValidationError> mapToValidationErrors(ValidationException validationEx
9393
new FileValidationError(
9494
validationException.getSchemaLocation(),
9595
validationException.getPointerToViolation(),
96-
validationException.getMessage()
96+
validationException.getMessage(),
97+
validationException.getKeyword()
9798
)
9899
);
99100
} else {

gbfs-validator-java/src/test/java/org/entur/gbfs/validation/model/ValidationResultTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ private FileValidationError generateFileValidationError(String message) {
8888
return new FileValidationError(
8989
"schema/path",
9090
"violation/path",
91-
message
91+
message,
92+
"keyword"
9293
);
9394
}
9495
}

0 commit comments

Comments
 (0)