示例#1
0
class ModifyExtTableInfo(Inputs):
    _optional = deepcopy(PROPERTIES)

    for _v in _optional.values():
        _v["type"] = [_v["type"], "null"]
    _schema = {"type": "object", "properties": _optional}
    json = [JsonSchema(schema=_schema)]
示例#2
0
class CreateExtDatasourceCon(Inputs):
    _schema = {
        "type": "object",
        "required": list(PROPERTIES.keys()),
        "properties": PROPERTIES,
    }

    json = [JsonSchema(schema=_schema)]
示例#3
0
class GetExtDatasourceCon(Inputs):
    _schema = {
        "type": "object",
        "properties": {
            "source_id": {
                "type": "string"
            }
        },
        "required": ["source_id"],
    }
    args = [JsonSchema(schema=_schema)]
示例#4
0
class PredictInputs(Inputs):
    json = [
        JsonSchema(
            schema={
                "type": "object",
                "properties": {
                    "text": {
                        "type": "string"
                    }
                },
                "required": ["text"]
            })
    ]
示例#5
0
class CopyExtTableInfo(Inputs):
    _schema = {
        "type": "object",
        "properties": {
            "template_source_id": {
                "type": "string"
            },
            "target_source_id": {
                "type": "string"
            },
        },
        "required": ["template_source_id", "target_source_id"]
    }
    json = [JsonSchema(schema=_schema)]
示例#6
0
class LoginInput(Inputs):
    _schema = {
        "type": "object",
        "properties": {
            "username": {
                "type": "string"
            },
            "password": {
                "type": "string"
            }
        },
        "required": ["username", "password"],
    }
    json = [JsonSchema(schema=_schema)]
示例#7
0
class CreateExtCleanInfo(Inputs):
    _schema = {
        "type": "object",
        "properties": {
            "source_id": {
                "type": "string"
            },
            "tables": {
                "type": "array",
                "items": {
                    "type": "string",
                },
            },
        },
        "required": ["source_id", "tables"],
    }
    json = [JsonSchema(schema=_schema)]
示例#8
0
class BatchModifyExtTableInfo(Inputs):
    _schema = {
        "type": "object",
        "properties": {
            "id": {
                "type": "array",
                "items": {
                    "type": "integer"
                },
                "uniqueItems": True
            },
            "alias_table_name": {
                "type": ["string", "null"]
            },
            "sync_column": {
                "type": ["array", "null"],
                "items": {
                    "type": "string"
                },
                "uniqueItems": True
            },
            "order_column": {
                "type": ["array", "null"],
                "items": {
                    "type": "string"
                },
                "uniqueItems": True
            },
            "limit_num": {
                "type": ["integer", "null"]
            },
            "filter": {
                "type": ["string", "null"]
            },
            "filter_format": {
                "type": ["string", "null"]
            },
            "weight": {
                "type": ["integer", "null"]
            },
        },
        "required": ["id"],
    }
    json = [JsonSchema(schema=_schema)]
示例#9
0
class GetExtTableInfos(Inputs):
    _schema = {
        "type": "object",
        "properties": {
            "source_id": {
                "type": "string"
            },
            "table_name": {
                "type": "string"
            },
            "weight": {
                "type": "string",
                "enum": ["0", "1", "2", ""]
            },
            "record_num": {
                "type": "string"
            },
        },
    }
    args = [JsonSchema(schema=_schema)]
示例#10
0
class ValidateInputs(Inputs):
    """class for input validation.

    :param request: flask.Request object to validate.
    """

    json = [JsonSchema(schema=schema)]

    def validate(self):
        """Validate incoming request data. Returns True if all data is valid.
        Adds each of the validator's error messages to Inputs.errors if not valid.

        :returns: Boolean
        """
        res = Inputs.validate(self)
        for prop in schema['properties']:
            if not prop in self._request.get_json():
                res = False
                self.errors += ["Missing {} attribue!".format(prop)]
        return res
示例#11
0
class ModiflyExtCleanInfo(Inputs):
    """
    [{"origin_table":"table1", "columns":["columns1", "columns2"], "convert_str":{"column1":"type1"}},
        {"origin_table":"table2", "columns":["columns1", "columns2"], "convert_str":{"column2":"type2"}},  ]
    """
    _schema = {
        "type": "object",
        "properties": {
            "data": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "origin_table": {
                            "type": "string"
                        },
                        "columns": {
                            "type": "array",
                            "items": {
                                "type": "string"
                            },
                        },
                        "convert_str": {
                            "type": "object",
                            "patternProperties": {
                                ".*": {
                                    "type": "string"
                                },
                            },
                        },
                    },
                    "required": ["origin_table", "columns"],
                },
            },
        },
        "required": ["data"],
    }
    json = [JsonSchema(schema=_schema)]
示例#12
0
文件: api.py 项目: imrehg/eatme
class RegistrationInputs(Inputs):
    json = [JsonSchema(schema=registration_schema)]
示例#13
0
class SmsRequestJsonValidator(Inputs):
    json = [JsonSchema(schema=sms_request_schema)]
示例#14
0
class ModifyExtDatasourceCon(Inputs):
    _schema = {"type": "object", "properties": PROPERTIES}
    json = [JsonSchema(schema=_schema)]
 class JsonInputs(Inputs):
     json = [JsonSchema(schema=pollination_schema)]
示例#16
0
class UserValidator(Inputs):
    json = [JsonSchema(schema=user_schema)]
示例#17
0
class GreetingInputs(Inputs):
    json = [JsonSchema(schema=greeting_schema)]
示例#18
0
class LinearRegressionInputs(Inputs):
    json = [JsonSchema(schema=schema_linear)]
示例#19
0
文件: api.py 项目: imrehg/eatme
class RoleInputs(Inputs):
    json = [JsonSchema(schema=roles_schema)]
示例#20
0
class ProductPostValidator(Inputs):
    json = [JsonSchema(product_json_schema), product_not_exists]
示例#21
0
class UserInputs(Inputs):
    json = [JsonSchema(schema=user_schema)]
示例#22
0
class ValidateNewMedicine(Inputs):
    json = [JsonSchema(schema=create_medicine_schema)]
示例#23
0
class ShortenerInputs(Inputs):
   json = [JsonSchema(schema=shortener_schema)]
示例#24
0
class ItemValidator(Inputs):
    json = [JsonSchema(schema=item_schema)]
示例#25
0
class JsonInputs(Inputs):
    json = [JsonSchema(schema=schema)]
示例#26
0
文件: api.py 项目: imrehg/eatme
class NewRecordInputs(Inputs):
    json = [JsonSchema(schema=new_record_schema)]
示例#27
0
class CreateInputs(Inputs):
    json = [JsonSchema(schema=create_schema)]
示例#28
0
文件: api.py 项目: imrehg/eatme
class UpdatedRecordInputs(Inputs):
    json = [JsonSchema(schema=updated_record_schema)]
示例#29
0
class ProductPutValidator(Inputs):
    rule = {'id': [DataRequired(), id_product_exists]}
    json = [JsonSchema(product_json_schema)]
示例#30
0
文件: api.py 项目: imrehg/eatme
class TargetInputs(Inputs):
    json = [JsonSchema(schema=target_schema)]