Skip to content

Commit a754a4a

Browse files
authored
Merge pull request #186 from weaviate/feat/generics-separation
Refactor: Remove generics from core protocol layer
2 parents f44649c + d006042 commit a754a4a

27 files changed

+129
-206
lines changed

.github/workflows/main.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
uses: actions/upload-artifact@v4
9393
with:
9494
name: test-results-unit-${{ matrix.server }}
95-
path: TestResults/test-unit-results.trx
95+
path: src/Weaviate.Client.Tests/TestResults/test-unit-results.trx
9696
retention-days: 3
9797

9898
- name: Login to Docker Hub
@@ -113,7 +113,7 @@ jobs:
113113
uses: actions/upload-artifact@v4
114114
with:
115115
name: test-results-integration-${{ matrix.server }}
116-
path: TestResults/test-integration-results.trx
116+
path: src/Weaviate.Client.Tests/TestResults/test-integration-results.trx
117117
retention-days: 3
118118

119119
- name: stop weaviate

src/Example/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static async Task Main()
5656

5757
WeaviateClient weaviate = await Connect.Local();
5858

59-
var collection = weaviate.Collections.Use<Cat>("Cat");
59+
var collection = weaviate.Collections.Use("Cat");
6060

6161
// Should throw CollectionNotFound
6262
try
@@ -87,7 +87,7 @@ static async Task Main()
8787
VectorConfig = new VectorConfig("default", new Vectorizer.Text2VecWeaviate()),
8888
};
8989

90-
collection = await weaviate.Collections.Create<Cat>(catCollection);
90+
collection = await weaviate.Collections.Create(catCollection);
9191

9292
await foreach (var c in weaviate.Collections.List())
9393
{

src/Weaviate.Client.Tests/Integration/Datasets/Datasets.cs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public static Dictionary<
265265
int expectedErrors,
266266
int expectedReferences,
267267
int expectedReferencedObjects,
268-
IEnumerable<BatchInsertRequest<object>[]> data
268+
IEnumerable<BatchInsertRequest[]> data
269269
)
270270
> Cases =>
271271
new()
@@ -277,11 +277,11 @@ IEnumerable<BatchInsertRequest<object>[]> data
277277
0,
278278
[
279279
[
280-
BatchInsertRequest.Create<object>(
280+
BatchInsertRequest.Create(
281281
new { Name = "some name" },
282282
vectors: Vector.Create(1, 2, 3)
283283
),
284-
BatchInsertRequest.Create<object>(
284+
BatchInsertRequest.Create(
285285
new { Name = "some other name" },
286286
id: _reusableUuids[0]
287287
),
@@ -295,7 +295,7 @@ IEnumerable<BatchInsertRequest<object>[]> data
295295
0,
296296
[
297297
[
298-
BatchInsertRequest.Create<object>(
298+
BatchInsertRequest.Create(
299299
new
300300
{
301301
Name = "some name",
@@ -314,7 +314,7 @@ IEnumerable<BatchInsertRequest<object>[]> data
314314
0,
315315
0,
316316
[
317-
[BatchInsertRequest.Create<object>(new { Name = 1 })],
317+
[BatchInsertRequest.Create(new { Name = 1 })],
318318
]
319319
),
320320
["batch with self-reference"] = (
@@ -324,25 +324,25 @@ IEnumerable<BatchInsertRequest<object>[]> data
324324
1,
325325
[
326326
[
327-
BatchInsertRequest.Create<object>(
327+
BatchInsertRequest.Create(
328328
new { Name = "Name 1" },
329329
id: _reusableUuids[0]
330330
),
331-
BatchInsertRequest.Create<object>(
331+
BatchInsertRequest.Create(
332332
new { Name = "Name 2" },
333333
id: _reusableUuids[1]
334334
),
335-
BatchInsertRequest.Create<object>(
335+
BatchInsertRequest.Create(
336336
new { Name = "Name 3" },
337337
id: _reusableUuids[2]
338338
),
339-
BatchInsertRequest.Create<object>(
339+
BatchInsertRequest.Create(
340340
new { Name = "Name 4" },
341341
id: _reusableUuids[3]
342342
),
343343
],
344344
[
345-
BatchInsertRequest.Create<object>(
345+
BatchInsertRequest.Create(
346346
new { Name = "Name 5" },
347347
references: [new("ref", _reusableUuids[1])]
348348
),
@@ -356,25 +356,25 @@ IEnumerable<BatchInsertRequest<object>[]> data
356356
2,
357357
[
358358
[
359-
BatchInsertRequest.Create<object>(
359+
BatchInsertRequest.Create(
360360
new { Name = "Name 1" },
361361
id: _reusableUuids[0]
362362
),
363-
BatchInsertRequest.Create<object>(
363+
BatchInsertRequest.Create(
364364
new { Name = "Name 2" },
365365
id: _reusableUuids[1]
366366
),
367-
BatchInsertRequest.Create<object>(
367+
BatchInsertRequest.Create(
368368
new { Name = "Name 3" },
369369
id: _reusableUuids[2]
370370
),
371-
BatchInsertRequest.Create<object>(
371+
BatchInsertRequest.Create(
372372
new { Name = "Name 4" },
373373
id: _reusableUuids[3]
374374
),
375375
],
376376
[
377-
BatchInsertRequest.Create<object>(
377+
BatchInsertRequest.Create(
378378
new { Name = "Name 5" },
379379
references: [new("ref", _reusableUuids[1], _reusableUuids[2])]
380380
),
@@ -388,33 +388,33 @@ IEnumerable<BatchInsertRequest<object>[]> data
388388
4,
389389
[
390390
[
391-
BatchInsertRequest.Create<object>(
391+
BatchInsertRequest.Create(
392392
new { Name = "Name 1" },
393393
id: _reusableUuids[0]
394394
),
395-
BatchInsertRequest.Create<object>(
395+
BatchInsertRequest.Create(
396396
new { Name = "Name 2" },
397397
id: _reusableUuids[1]
398398
),
399-
BatchInsertRequest.Create<object>(
399+
BatchInsertRequest.Create(
400400
new { Name = "Name 3" },
401401
id: _reusableUuids[2]
402402
),
403-
BatchInsertRequest.Create<object>(
403+
BatchInsertRequest.Create(
404404
new { Name = "Name 4" },
405405
id: _reusableUuids[3]
406406
),
407407
],
408408
[
409-
BatchInsertRequest.Create<object>(
409+
BatchInsertRequest.Create(
410410
new { Name = "Name 5" },
411411
references: [new("ref", _reusableUuids[1])]
412412
),
413-
BatchInsertRequest.Create<object>(
413+
BatchInsertRequest.Create(
414414
new { Name = "Name 6" },
415415
references: [new("ref2", _reusableUuids[2])]
416416
),
417-
BatchInsertRequest.Create<object>(
417+
BatchInsertRequest.Create(
418418
new { Name = "Name 7" },
419419
references:
420420
[

src/Weaviate.Client.Tests/Integration/TestAliases.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,14 @@ public async Task Test_Alias_To_Deleted_Collection_Persists_But_Queries_Fail()
438438
// Try to fetch objects using the alias as the collection name - should fail
439439
await Assert.ThrowsAnyAsync<WeaviateServerException>(async () =>
440440
await _weaviate
441-
.Collections.Use<object>(aliasName)
441+
.Collections.Use(aliasName)
442442
.Query.FetchObjects(cancellationToken: TestContext.Current.CancellationToken)
443443
);
444444

445445
// Try to fetch a specific object by ID using the alias - should also fail
446446
await Assert.ThrowsAnyAsync<WeaviateServerException>(async () =>
447447
await _weaviate
448-
.Collections.Use<object>(aliasName)
448+
.Collections.Use(aliasName)
449449
.Query.FetchObjectByID(
450450
id1,
451451
cancellationToken: TestContext.Current.CancellationToken

src/Weaviate.Client.Tests/Integration/TestBatch.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public async Task InsertMany(string key)
1414
int expectedErrors,
1515
int expectedReferences,
1616
int expectedReferencedObjects,
17-
IEnumerable<BatchInsertRequest<object>[]> requests
17+
IEnumerable<BatchInsertRequest[]> requests
1818
) = DatasetBatchInsertMany.Cases[key];
1919

2020
var client = await CollectionFactory(

src/Weaviate.Client.Tests/Integration/TestBatchDelete.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public async Task Test_Delete_Many_Return()
1414
);
1515

1616
await collection.Data.InsertMany(
17-
[BatchInsertRequest.Create<object>(new { name = "delet me" }, Guid.NewGuid())],
17+
[BatchInsertRequest.Create(new { name = "delet me" }, Guid.NewGuid())],
1818
cancellationToken: TestContext.Current.CancellationToken
1919
);
2020

src/Weaviate.Client.Tests/Integration/TestCollectionAggregate.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public async Task Test_Collection_Length(int howMany)
1818
);
1919

2020
await collectionClient.Data.InsertMany(
21-
Enumerable.Repeat(BatchInsertRequest.Create<object>(new { }), howMany),
21+
Enumerable.Repeat(BatchInsertRequest.Create(new { }), howMany),
2222
cancellationToken: TestContext.Current.CancellationToken
2323
);
2424

src/Weaviate.Client.Tests/Integration/TestCollections.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public async Task Collection_Creates_And_Retrieves_Reranker_Config()
124124

125125
// Act
126126
var collection = await _weaviate
127-
.Collections.Use<dynamic>(collectionClient.Name)
127+
.Collections.Use(collectionClient.Name)
128128
.Config.Get(TestContext.Current.CancellationToken);
129129

130130
// Assert
@@ -148,7 +148,7 @@ public async Task Collection_Creates_And_Retrieves_Generative_Config()
148148

149149
// Act
150150
var collection = await _weaviate
151-
.Collections.Use<dynamic>(collectionClient.Name)
151+
.Collections.Use(collectionClient.Name)
152152
.Config.Get(TestContext.Current.CancellationToken);
153153

154154
// Assert
@@ -1170,7 +1170,7 @@ public async Task Test_Return_Blob_Property()
11701170

11711171
// Insert many
11721172
await collection.Data.InsertMany(
1173-
BatchInsertRequest.Create<object>([new { blob = blobData }]),
1173+
BatchInsertRequest.Create([new { blob = blobData }]),
11741174
TestContext.Current.CancellationToken
11751175
);
11761176

src/Weaviate.Client.Tests/Integration/TestFilters.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ public async Task Filtering()
1212
var cA = await CollectionFactory<TestData>("A", "Collection A");
1313

1414
var uuid_A1 = await cA.Data.Insert(
15-
new() { Name = "A1", Size = 3 },
15+
new TestData { Name = "A1", Size = 3 },
1616
cancellationToken: TestContext.Current.CancellationToken
1717
);
1818
var uuid_A2 = await cA.Data.Insert(
19-
new() { Name = "A2", Size = 5 },
19+
new TestData { Name = "A2", Size = 5 },
2020
cancellationToken: TestContext.Current.CancellationToken
2121
);
2222

@@ -44,11 +44,11 @@ public async Task FilteringWithMetadataDates()
4444
);
4545

4646
var uuid_A1 = await cA.Data.Insert(
47-
new() { Name = "A1", Size = 3 },
47+
new TestData { Name = "A1", Size = 3 },
4848
cancellationToken: TestContext.Current.CancellationToken
4949
);
5050
var uuid_A2 = await cA.Data.Insert(
51-
new() { Name = "A2", Size = 5 },
51+
new TestData { Name = "A2", Size = 5 },
5252
cancellationToken: TestContext.Current.CancellationToken
5353
);
5454

@@ -84,11 +84,11 @@ public async Task FilteringWithExpressions()
8484
var cA = await CollectionFactory<TestData>("A", "Collection A");
8585

8686
var uuid_A1 = await cA.Data.Insert(
87-
new() { Name = "A1", Size = 3 },
87+
new TestData { Name = "A1", Size = 3 },
8888
cancellationToken: TestContext.Current.CancellationToken
8989
);
9090
var uuid_A2 = await cA.Data.Insert(
91-
new() { Name = "A2", Size = 5 },
91+
new TestData { Name = "A2", Size = 5 },
9292
cancellationToken: TestContext.Current.CancellationToken
9393
);
9494

@@ -121,12 +121,12 @@ public async Task FilteringReferences(string key)
121121
var uuidsTo = new[]
122122
{
123123
await cTarget.Data.Insert(
124-
new() { Name = "first", Size = 0 },
124+
new TestData { Name = "first", Size = 0 },
125125
id: _reusableUuids[0],
126126
cancellationToken: TestContext.Current.CancellationToken
127127
),
128128
await cTarget.Data.Insert(
129-
new() { Name = "second", Size = 15 },
129+
new TestData { Name = "second", Size = 15 },
130130
id: _reusableUuids[1],
131131
cancellationToken: TestContext.Current.CancellationToken
132132
),

src/Weaviate.Client.Tests/Integration/TestIterator.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public async Task Test_Iterator()
1313
);
1414

1515
await collection.Data.InsertMany(
16-
BatchInsertRequest.Create<object>([new { Name = "Name 1" }, new { Name = "Name 2" }]),
16+
BatchInsertRequest.Create([new { Name = "Name 1" }, new { Name = "Name 2" }]),
1717
TestContext.Current.CancellationToken
1818
);
1919

@@ -69,7 +69,7 @@ public async Task Test_Iterator_Arguments(
6969
// Insert test data
7070
var insertData = Enumerable
7171
.Range(0, 10)
72-
.Select(i => BatchInsertRequest.Create<object>(new { data = i, text = "hi" }));
72+
.Select(i => BatchInsertRequest.Create(new { data = i, text = "hi" }));
7373
await collection.Data.InsertMany(
7474
insertData,
7575
cancellationToken: TestContext.Current.CancellationToken
@@ -173,7 +173,7 @@ public async Task Test_Iterator_With_Default_Generic()
173173

174174
var insertData = Enumerable
175175
.Range(0, 10)
176-
.Select(_ => BatchInsertRequest.Create<object>(new { @this = "this", that = "that" }))
176+
.Select(_ => BatchInsertRequest.Create(new { @this = "this", that = "that" }))
177177
.ToArray();
178178
await collection.Data.InsertMany(insertData, TestContext.Current.CancellationToken);
179179

@@ -205,13 +205,13 @@ public async Task Test_Iterator_With_Default_Generic()
205205
[InlineData(0)]
206206
[InlineData(1)]
207207
[InlineData(2)]
208-
[InlineData(CollectionClient<int>.ITERATOR_CACHE_SIZE - 1)]
209-
[InlineData(CollectionClient<int>.ITERATOR_CACHE_SIZE)]
210-
[InlineData(CollectionClient<int>.ITERATOR_CACHE_SIZE + 1)]
211-
[InlineData(2 * CollectionClient<int>.ITERATOR_CACHE_SIZE - 1)]
212-
[InlineData(2 * CollectionClient<int>.ITERATOR_CACHE_SIZE)]
213-
[InlineData(2 * CollectionClient<int>.ITERATOR_CACHE_SIZE + 1)]
214-
[InlineData(20 * CollectionClient<int>.ITERATOR_CACHE_SIZE)]
208+
[InlineData(CollectionClient.ITERATOR_CACHE_SIZE - 1)]
209+
[InlineData(CollectionClient.ITERATOR_CACHE_SIZE)]
210+
[InlineData(CollectionClient.ITERATOR_CACHE_SIZE + 1)]
211+
[InlineData(2 * CollectionClient.ITERATOR_CACHE_SIZE - 1)]
212+
[InlineData(2 * CollectionClient.ITERATOR_CACHE_SIZE)]
213+
[InlineData(2 * CollectionClient.ITERATOR_CACHE_SIZE + 1)]
214+
[InlineData(20 * CollectionClient.ITERATOR_CACHE_SIZE)]
215215
public async Task Test_Iterator_Basic(uint count)
216216
{
217217
var collection = await CollectionFactory(
@@ -223,7 +223,7 @@ public async Task Test_Iterator_Basic(uint count)
223223
{
224224
var insertData = Enumerable
225225
.Range(0, (int)count)
226-
.Select(i => BatchInsertRequest.Create<object>(new { data = i }))
226+
.Select(i => BatchInsertRequest.Create(new { data = i }))
227227
.ToArray();
228228
await collection.Data.InsertMany(insertData, TestContext.Current.CancellationToken);
229229
}
@@ -267,7 +267,7 @@ public async Task Test_Iterator_With_After()
267267

268268
var insertData = Enumerable
269269
.Range(0, 10)
270-
.Select(i => BatchInsertRequest.Create<object>(new { data = i }))
270+
.Select(i => BatchInsertRequest.Create(new { data = i }))
271271
.ToArray();
272272
await collection.Data.InsertMany(insertData, TestContext.Current.CancellationToken);
273273

0 commit comments

Comments
 (0)