amschaal / SIMS

SIMS (Sequencing Information Management System), Successor to SLIMS, in search of a better name...
0 stars 0 forks source link

Terminate support of invalid JSON Schema 'table' type #22

Open amschaal opened 4 months ago

amschaal commented 4 months ago

Convert 'table' type properties used by the submission system to their proper 'list' type. Details demonstrated by codeblock below:

def convert_to_jsonschema(coreomics_schema):
    import copy
    schema = copy.deepcopy(coreomics_schema)
    schema['type'] = 'object'
    # Make changes to schema
    for prop in schema['properties'].keys():
        if 'table' == schema['properties'].get(prop,{}).get('type', '').lower():
            list_prop = {'type': 'array', 'items': schema['properties'][prop].pop('schema')}
            schema['properties'][prop] = list_prop
            schema['properties'][prop]['items']['type'] = 'object'
    return schema

Modify frontend code to only work with proper JSON Schema (list of objects).