public static ComponentConfig FromConfig(ConfigParams config) { var descriptor = Descriptor.FromString(config.GetAsNullableString("descriptor")); var type = TypeDescriptor.FromString(config.GetAsNullableString("type")); if (descriptor == null && type == null) { throw new ConfigException(null, "BAD_CONFIG", "Component configuration must have descriptor or type"); } return(new ComponentConfig(descriptor, type, config)); }