Пример #1
0
    'created_on': {
        'type': str,
    },
    'updated_on': {
        'type': str,
    },
    'priority_array_write': {
        'type': fields.Nested(priority_array_write_fields),
    },
    'point_store': {
        'type': fields.Nested(point_store_fields),
    }
}

point_all_fields = {}
map_rest_schema(point_all_attributes, point_all_fields)
map_rest_schema(point_return_attributes, point_all_fields)


def add_nested_priority_array_write():
    nested_priority_array_write_parser = reqparse.RequestParser()
    nested_priority_array_write_parser.add_argument(
        '_1', type=float, location=('priority_array_write', ))
    nested_priority_array_write_parser.add_argument(
        '_2', type=float, location=('priority_array_write', ))
    nested_priority_array_write_parser.add_argument(
        '_3', type=float, location=('priority_array_write', ))
    nested_priority_array_write_parser.add_argument(
        '_4', type=float, location=('priority_array_write', ))
    nested_priority_array_write_parser.add_argument(
        '_5', type=float, location=('priority_array_write', ))
Пример #2
0
 def test_map_rest_schema(self):
     mapper = {}
     map_rest_schema(network_all_attributes, mapper)
     print(mapper)
Пример #3
0
    },
    'last_name': {
        'type': str,
    },
    'username': {
        'type': str,
    },
    'email': {
        'type': str,
    },
    'state': {
        'type': str,
        'nested': True,
        'dict': 'state.name'
    }
}

user_return_fields = {}
map_rest_schema(user_return_attributes, user_return_fields)

user_all_fields = {}
map_rest_schema(user_all_attributes, user_all_fields)
map_rest_schema(user_return_attributes, user_all_fields)

user_all_fields_with_children_base = {
    'devices': fields.List(fields.Nested(device_nested_return_fields)),
    'sites': fields.List(fields.Nested(user_site_nested_return_fields))
}
user_all_fields_with_children = deepcopy(user_return_fields)
user_all_fields_with_children.update(user_all_fields_with_children_base)
Пример #4
0
        'type': bool,
    },
    'tags': {
        'type': str
    }
}

network_return_attributes = {
    'uuid': {
        'type': str,
    },
    'created_on': {
        'type': str,
    },
    'updated_on': {
        'type': str,
    }
}

network_all_fields = {}
map_rest_schema(network_return_attributes, network_all_fields)
map_rest_schema(network_all_attributes, network_all_fields)

network_all_fields_with_children = deepcopy(network_all_fields)
network_all_fields_with_children['devices'] = fields.List(
    fields.Nested(device_all_fields_with_children))

network_all_fields_without_point_children = deepcopy(network_all_fields)
network_all_fields_without_point_children['devices'] = fields.List(
    fields.Nested(device_all_fields))
Пример #5
0
        'type': str,
        'required': False,
    },
    'lat': {
        'type': float,
        'required': False,
    },
    'lon': {
        'type': float,
        'required': False,
    },
    'time_zone': {
        'type': str,
        'required': False,
    },
}

site_return_attributes = {
    'uuid': {
        'type': str,
    }
}

site_return_fields = {}
map_rest_schema(site_return_attributes, site_return_fields)
map_rest_schema(site_all_attributes, site_return_fields)

site_all_fields = {}
map_rest_schema(site_all_attributes, site_all_fields)
map_rest_schema(site_return_attributes, site_all_fields)
Пример #6
0
    },
    'history_enable': {
        'type': bool,
    },
    'tags': {
        'type': str
    }
}

device_return_attributes = {
    'uuid': {
        'type': str,
    },
    'created_on': {
        'type': str,
    },
    'updated_on': {
        'type': str,
    }
}

device_all_fields = {}
map_rest_schema(device_return_attributes, device_all_fields)
map_rest_schema(device_all_attributes, device_all_fields)

device_all_fields_with_children_base = {
    'points': fields.List(fields.Nested(point_all_fields))
}
device_all_fields_with_children = deepcopy(device_all_fields)
device_all_fields_with_children.update(device_all_fields_with_children_base)
Пример #7
0
from src.resources.utils import map_rest_schema

schedule_all_attributes = {
    'name': {
        'type': str,
        'required': True,
    }
}

schedule_return_attributes = {
    'uuid': {
        'type': str,
    },
    'name': {
        'type': str,
    },
    'created_on': {
        'type': str,
    },
    'updated_on': {
        'type': str,
    }
}

schedule_all_fields = {}
map_rest_schema(schedule_return_attributes, schedule_all_fields)
map_rest_schema(schedule_all_attributes, schedule_all_fields)
Пример #8
0
    'uuid': {
        'type': str,
    },
    'user_uuid': {
        'type': str,
    },
    'site_uuid': {
        'type': str,
    },
}

user_site_nested_return_attributes = {
    'uuid': {
        'type': str,
    },
    'site_uuid': {
        'type': str,
    },
}

user_site_return_fields = {}
map_rest_schema(user_site_return_attributes, user_site_return_fields)

user_site_nested_return_fields = {}
map_rest_schema(user_site_nested_return_attributes,
                user_site_nested_return_fields)

user_site_all_fields = {}
map_rest_schema(user_site_all_attributes, user_site_all_fields)
map_rest_schema(user_site_return_attributes, user_site_all_fields)