in Elastic.SemanticKernel.Connectors.Elasticsearch/Internal/Helpers/VectorStoreRecordPropertyVerification.cs [93:118]
public static void VerifyPropertyType(string propertyName, Type propertyType, HashSet<Type> supportedTypes, HashSet<Type> supportedEnumerableElementTypes, string propertyCategoryDescription)
{
// Add shortcut before testing all the more expensive scenarios.
if (supportedTypes.Contains(propertyType))
{
return;
}
// Check all collection scenarios and get stored type.
if (supportedEnumerableElementTypes.Count > 0 && IsSupportedEnumerableType(propertyType))
{
var typeToCheck = GetCollectionElementType(propertyType);
if (!supportedEnumerableElementTypes.Contains(typeToCheck))
{
var supportedEnumerableElementTypesString = string.Join(", ", supportedEnumerableElementTypes!.Select(t => t.FullName));
throw new ArgumentException($"Enumerable {propertyCategoryDescription} properties must have one of the supported element types: {supportedEnumerableElementTypesString}. Element type of the property '{propertyName}' is {typeToCheck.FullName}.");
}
}
else
{
// if we got here, we know the type is not supported
var supportedTypesString = string.Join(", ", supportedTypes.Select(t => t.FullName));
throw new ArgumentException($"{propertyCategoryDescription} properties must be one of the supported types: {supportedTypesString}. Type of the property '{propertyName}' is {propertyType.FullName}.");
}
}