Example #1
0
 def payload_schema(self):
     return validx.Dict(
         {
             "sub": validx.Const(self.sub),
             "iat": validx.Float(min=0),
             "exp": validx.Float(min=0),
         },
         optional=None if self.ttl else ("exp",),
         extra=(validx.Str(), validx.Any()),
     )
Example #2
0
 Contract(
     name="push_test_selection_data",
     description="Test and build CI Tasks that should be scheduled for a given push",
     validate_in=v.Dict(
         {
             "branch": v.Str(),
             "rev": v.Str(),
         }
     ),
     validate_out=v.Dict(
         {
             "config_groups": v.Dict(
                 extra=(v.Str(), v.List(v.Str(minlen=1))),
             ),
             "groups": v.Dict(
                 extra=(v.Str(), v.Float()),
             ),
             "known_tasks": v.List(v.Str(minlen=1)),
             "reduced_tasks": v.Dict(
                 extra=(v.Str(), v.Float()),
             ),
             "reduced_tasks_higher": v.Dict(
                 extra=(v.Str(), v.Float()),
             ),
             "tasks": v.Dict(
                 extra=(v.Str(), v.Float()),
             ),
         }
     ),
 ),
 Contract(
import validx as v

city_schema: v.Validator = v.Dict(
    {
        "location": v.Tuple(v.Float(min=-90, max=90), v.Float(min=-180,
                                                              max=180)),
        "name": v.Str(),
        "alt_names": v.List(v.Str(), unique=True),
        "population": v.Dict({
            "city": v.Int(min=0),
            "metro": v.Int(min=0)
        }),
    },
    extra=(v.Str(), v.Any()),
)
Example #4
0
         v.List(v.Tuple(v.Str(minlen=1), v.Type(FailureType))),
     )),
 ),
 Contract(
     name="push_test_selection_data",
     description=
     "Test and build CI Tasks that should be scheduled for a given push",
     validate_in=v.Dict({
         "branch": v.Str(),
         "rev": v.Str(),
     }),
     validate_out=v.Dict({
         "config_groups":
         v.Dict(extra=(v.Str(), v.List(v.Str(minlen=1))), ),
         "groups":
         v.Dict(extra=(v.Str(), v.Float()), ),
         "known_tasks":
         v.List(v.Str(minlen=1)),
         "reduced_tasks":
         v.Dict(extra=(v.Str(), v.Float()), ),
         "reduced_tasks_higher":
         v.Dict(extra=(v.Str(), v.Float()), ),
         "tasks":
         v.Dict(extra=(v.Str(), v.Float()), ),
     }),
 ),
 Contract(
     name="pushes",
     description="List available pushes",
     validate_in=v.Dict({
         "branch": v.Str(),