Skip to content

Commit 3ac7861

Browse files
.Net: Fix weaviate collection name checking (#13242)
### Motivation and Context According to the weaviate document, the collection name allows the use of underscores - [collections](https://docs.weaviate.io/weaviate/config-refs/collections#class): `The collection name validation regex is /^[A-Z][_0-9A-Za-z]*$/.` ### Description Allow `_` in weaviate collection name. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [x] I didn't break anyone 😄 --------- Co-authored-by: westey <[email protected]>
1 parent 1526dbc commit 3ac7861

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎dotnet/src/VectorData/Weaviate/WeaviateCollection.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,9 @@ private static void VerifyCollectionName(string collectionName)
559559

560560
foreach (char character in collectionName)
561561
{
562-
if (!((character is >= 'a' and <= 'z') || (character is >= 'A' and <= 'Z') || (character is >= '0' and <= '9')))
562+
if (!((character is >= 'a' and <= 'z') || (character is >= 'A' and <= 'Z') || (character is >= '0' and <= '9') || character is '_'))
563563
{
564-
throw new ArgumentException("Collection name must contain only ASCII letters and digits.", nameof(collectionName));
564+
throw new ArgumentException("Collection name must contain only ASCII letters and digits or underscores. The first character must be an upper case letter.", nameof(collectionName));
565565
}
566566
}
567567
}

0 commit comments

Comments
 (0)