Exemplo n.º 1
0
def generate_schema():
    """
    This is the main, global defintion for the data type 'hello_tablelike'.
    From this definition we can generate Eve configurations for server
    endpoints that read/write the data, a python client for working with
    batches of tablelike_entries that conform to this schema and talk to the
    server, and auto generated smoke tests that exercise the endpoints with
    randomly generated data.
    """
    schema = TablelikeSchema(COLLECTION_NAME)
    schema.add_numeric_attribute('flt_val_0', min_val=0.0, max_val=None)
    schema.add_numeric_attribute('flt_val_1', min_val=-10.0, max_val=10.0)
    schema.add_categoric_attribute('string_val', valid_values=['x', 'y', 'z'])
    schema.add_categoric_list_attribute('cat_list_val',
                                        valid_values=['a', 'b', 'c'])
    schema.add_numeric_list_attribute('num_list_val')
    schema.add_foreignid_attribute('foreignid_val')
    schema.add_foreignid_list_attribute('foreignid_list_val')
    schema.add_json_attribute('json_val')
    schema.add_int_attribute('int_val')
    schema.add_int_list_attribute('int_list_val')

    schema.add_index(['string_val'])
    schema.add_index(['string_val', 'int_val'])
    return schema
Exemplo n.º 2
0
def generate_schema():
    schema = TablelikeSchema(COLLECTION_NAME)
    schema.add_categoric_attribute('species_number', valid_values=None)
    schema.add_categoric_attribute('short_latin_name', valid_values=None)
    schema.add_categoric_attribute('name', valid_values=None)
    schema.add_int_attribute('display_order', min_val=None, max_val=None)
    schema.add_categoric_attribute('group_name', valid_values=None)
    schema.add_boolean_attribute('selected_by_default')
    return schema