예제 #1
0
    def _get_schema(cls):
        if hasattr(cls, 'params_schema'):
            return cls.params_schema

        return [
            convert_schema(i)
            for i in exclude(cls.run.__annotations__, 'return').values()
        ]
예제 #2
0
 def __named_json_schema__(cls):
     return cls.__name__, {
         'type': 'object',
         'additionalProperties': cls._additional_properties,
         'properties':
         {k: convert_schema(v)
          for k, v in cls.schema_fields()},
     }
예제 #3
0
        def to_json_schema(cls):
            sch = convert_schema(cls.inner)
            if cls.min_value is not None:
                sch['minimum'] = cls.min_value
            if cls.max_value is not None:
                sch['maximum'] = cls.max_value

            return sch
예제 #4
0
        def to_json_schema(cls):
            sch = convert_schema(cls.inner)
            if cls.min_value is not None:
                sch['minimum'] = cls.min_value
            if cls.max_value is not None:
                sch['maximum'] = cls.max_value

            return sch
예제 #5
0
 def to_json_schema(cls):
     return {
         'type': 'object',
         'additionalProperties': False,
         'properties':
         {k: convert_schema(v)
          for k, v in cls.schema_fields()},
     }
예제 #6
0
파일: task.py 프로젝트: erinix/middleware
    def _get_schema(cls):
        if hasattr(cls, 'params_schema'):
            return cls.params_schema

        return [convert_schema(i) for i in exclude(cls.run.__annotations__, 'return').values()]
예제 #7
0
 def wrapped(fn):
     fn.status_schema = convert_schema(sch)
     return fn
예제 #8
0
 def wrapped(fn):
     fn.params_schema = convert_schema(sch)
     return fn
예제 #9
0
파일: plugin.py 프로젝트: erinix/middleware
 def wrapped(fn):
     fn.status_schema = convert_schema(sch)
     return fn
예제 #10
0
파일: plugin.py 프로젝트: erinix/middleware
 def wrapped(fn):
     fn.params_schema = convert_schema(sch)
     return fn
예제 #11
0
 def __named_json_schema__(cls):
     return cls.__name__, {
         'type': 'object',
         'additionalProperties': cls._additional_properties,
         'properties': {k: convert_schema(v) for k, v in cls.schema_fields()},
     }