def _get_field_from_configuration(configs):
    """Get fields from configurations."""
    fields = {}
    for config in configs:
        if not isinstance(config, dict):
            raise exception.InvalidParameter(
                'config %s is not dict' % config
            )
        field_name = config['NAME']
        fields[field_name] = {
            'name': field_name,
            'id': field_name,
            'field_type': config.get('FIELD_TYPE', basestring),
            'display_type': config.get('DISPLAY_TYPE', 'text'),
            'validator': config.get('VALIDATOR', None),
            'js_validator': config.get('JS_VALIDATOR', None),
            'description': config.get('DESCRIPTION', field_name)
        }
    return fields
dataset/ETHPy150Open openstack/compass-core/compass/db/api/metadata.py/_get_field_from_configuration/original