Skip to content

Commit 9ec6cb4

Browse files
committed
Added comments
1 parent ab96a68 commit 9ec6cb4

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

gbfs-validator-java/src/main/java/org/mobilitydata/gbfs/validation/validator/GbfsJsonValidator.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,16 @@ private ParsedFeedContainer parseFeed(String name, InputStream raw) {
336336
}
337337
}
338338

339+
/**
340+
* Creates a validation result for a file that could not be parsed. Parsing can fail before
341+
* the exact version for a single file is known, so this resolves the best schema version
342+
* available and still returns file metadata alongside the parse errors.
343+
*
344+
* @param feedName The GBFS feed name
345+
* @param parsedContainer The parsed container holding original content and parse errors
346+
* @param preferredVersion The initially preferred GBFS version
347+
* @return A file validation result containing parse errors and any schema metadata that could be resolved
348+
*/
339349
private FileValidationResult createParsingErrorResult(
340350
String feedName,
341351
ParsedFeedContainer parsedContainer,
@@ -357,6 +367,15 @@ private FileValidationResult createParsingErrorResult(
357367
);
358368
}
359369

370+
/**
371+
* Resolves the version to use for a feed when building parse-error results. Some feed types
372+
* may not exist in the initially detected version, so this falls back to the newest version
373+
* that supports the feed in order to point the error result at a schema when possible.
374+
*
375+
* @param feedName The GBFS feed name
376+
* @param preferredVersion The initially detected or preferred GBFS version
377+
* @return The preferred version when it supports the feed, otherwise the newest version that does
378+
*/
360379
private Version resolveVersionForFeed(
361380
String feedName,
362381
Version preferredVersion

0 commit comments

Comments
 (0)