journal/tool/types.jq

26 lines
688 B
Plaintext
Raw Normal View History

2024-11-07 11:39:39 +00:00
import "typeLib" as typeLib;
def ensureExperience:
. as $experience |
typeLib::ensureObject |
$experience |
typeLib::ensureKey("experience"; "title") |
.title | typeLib::ensureString |
$experience |
typeLib::ensureKey("experience"; "text") |
.text | typeLib::ensureString
;
def ensureExportData:
. as $exportData |
if typeLib::typecheckingEnabled then
typeLib::ensureObject |
typeLib::ensureKey("exportData"; "customSubstances") |
typeLib::ensureKey("exportData"; "customUnits") |
typeLib::ensureKey("exportData"; "experiences") |
typeLib::ensureKey("exportData"; "substanceCompanions") |
(.experiences[] | ensureExperience)
end;