-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from chris48s/yaml-multidoc
allow parsing multi-doc yaml files
- Loading branch information
Showing
12 changed files
with
269 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
import Ajv from "ajv"; | ||
|
||
function formatErrors(filename, errors) { | ||
function getDocumentLocation(result) { | ||
if (result.documentIndex == null) { | ||
return result.fileLocation; | ||
} | ||
return `${result.fileLocation}[${result.documentIndex}]`; | ||
} | ||
|
||
function formatErrors(location, errors) { | ||
const ajv = new Ajv(); | ||
return ( | ||
ajv.errorsText(errors, { | ||
separator: "\n", | ||
dataVar: filename + "#", | ||
dataVar: location + "#", | ||
}) + "\n" | ||
); | ||
} | ||
|
||
export { formatErrors }; | ||
export { formatErrors, getDocumentLocation }; |
Oops, something went wrong.