File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -725,6 +725,36 @@ const validateStore: SchemaValidateFunction = function (
725
725
return validateTestTypes ( store , this . jsonModel , ctx . instancePath ) ;
726
726
} ;
727
727
728
+ // YAML validation using ajv
729
+ export function YamlTuplesValidator ( ) : ValidateFunction {
730
+ return new Ajv ( {
731
+ allErrors : true ,
732
+ verbose : true ,
733
+ passContext : true ,
734
+ $data : true ,
735
+ } )
736
+ . addFormat ( "user" , {
737
+ validate : Validate . user ,
738
+ } )
739
+ . addFormat ( "relation" , {
740
+ validate : Validate . relation ,
741
+ } )
742
+ . addFormat ( "object" , {
743
+ validate : Validate . object ,
744
+ } )
745
+ . addFormat ( "condition" , {
746
+ validate : Validate . relationshipCondition ,
747
+ } )
748
+ . addKeyword ( {
749
+ keyword : "valid_tuple" ,
750
+ type : "object" ,
751
+ schema : false ,
752
+ errors : true ,
753
+ validate : validateTuple ,
754
+ } )
755
+ . compile ( OPENFGA_TUPLES_SCHEMA ) ;
756
+ }
757
+
728
758
// YAML tuple validation
729
759
const OPENFGA_TUPLES_SCHEMA : Schema = {
730
760
type : "array" ,
You can’t perform that action at this time.
0 commit comments