depot/third_party/nixpkgs/pkgs/test/cue/default.nix
Default email a66bca1520 Project import generated by Copybara.
GitOrigin-RevId: 40f79f003b6377bd2f4ed4027dde1f8f922995dd
2022-12-17 11:02:37 +01:00

24 lines
478 B
Nix

{ writeCueValidator, runCommand, writeText, ... }:
let
validator = writeCueValidator
(writeText "schema.cue" ''
#Def1: {
field1: string
}
'')
{ document = "#Def1"; };
in runCommand "cue-validation" {} ''
cat > valid.json <<EOF
{ "field1": "abc" }
EOF
cat > invalid.json <<EOF
{ "field2": "abc" }
EOF
${validator} valid.json
if ${validator} invalid.json; then
echo "this example should fail"
exit 1
fi
touch $out
''