Thank you for contributing! This document provides guidelines for contributing to the Weaviate C# client.
This project uses Microsoft.CodeAnalysis.PublicApiAnalyzers to track changes to the public API surface. This ensures that breaking changes are intentional and reviewed.
The analyzer tracks public API members in two files located in src/Weaviate.Client/:
| File | Purpose |
|---|---|
PublicAPI.Shipped.txt |
APIs that have been released in a published version |
PublicAPI.Unshipped.txt |
APIs that are new/changed since the last release |
When you add a new public class, method, property, or other member, you'll see an RS0016 warning at build time:
warning RS0016: Symbol 'YourNewMethod' is not part of the declared public API
To fix this:
- Use the IDE quick-fix (lightbulb icon) to add the symbol to
PublicAPI.Unshipped.txt - Or run
dotnet format analyzers --diagnostics RS0016to auto-fix all missing entries
If you change or remove a public API member, you'll see an RS0017 warning:
warning RS0017: Symbol 'OldMethod' is part of the declared API, but could not be found
This is intentional - it alerts you to a potential breaking change. Before proceeding:
- Consider if the change is backward-compatible
- If removing/changing is intentional, update the corresponding line in
PublicAPI.Unshipped.txt - Document the breaking change in the changelog
When preparing a release:
- Review all entries in
PublicAPI.Unshipped.txt - Move the entries to
PublicAPI.Shipped.txt - Clear
PublicAPI.Unshipped.txt(keeping only#nullable enable)
The following analyzer warnings are currently suppressed in the project:
| Warning | Reason |
|---|---|
| RS0026 | Multiple overloads with optional parameters (API design advisory) |
| RS0027 | Optional parameter ordering (API design advisory) |
| RS0041 | Oblivious reference types (nullability advisory) |
These are design recommendations, not API tracking issues. They may be addressed in future refactoring efforts.
# Build the main library
dotnet build src/Weaviate.Client/Weaviate.Client.csproj
# Build and run tests
dotnet test src/Weaviate.Client.Tests/Weaviate.Client.Tests.csprojThe test project includes both unit tests and integration tests. Integration tests require a running Weaviate instance.
# Run all tests
dotnet test
# Run only unit tests
dotnet test --filter "Category!=Integration"By default, request and response logging is disabled to keep CI and test output clean.
The client integrates with .NET's configuration system through IConfiguration.
.NET's configuration system automatically reads environment variables when configured:
export Weaviate__LogRequests=true
dotnet runNote the double underscore __ which maps to nested configuration (colon : on Windows).
{
"Weaviate": {
"RestEndpoint": "localhost",
"RestPort": 8080,
"GrpcPort": 50051,
"LogRequests": true,
"RequestLoggingLevel": "Information"
}
}// In Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.Configure<WeaviateOptions>(
builder.Configuration.GetSection("Weaviate")
);
builder.Services.AddSingleton<WeaviateClient>();var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.AddEnvironmentVariables() // Automatically reads Weaviate__LogRequests
.Build();
var logRequests = configuration.GetValue<bool>("Weaviate:LogRequests");
var client = await new WeaviateClientBuilder()
.Local()
.UseRequestLogging(logRequests ? LogLevel.Information : LogLevel.Debug)
.BuildAsync();You can also enable logging programmatically:
var client = await new WeaviateClientBuilder()
.Local()
.UseRequestLogging(LogLevel.Information)
.BuildAsync();Integration tests support optional HTTP/gRPC request/response logging for debugging. Configuration uses .NET's standard IConfiguration system.
Logging output is captured by xUnit via [assembly: CaptureConsole] and displayed in test results under "Standard Output Messages".
Weaviate__LogRequests=true dotnet test --logger "console;verbosity=detailed"You can also set the logging level:
Weaviate__LogRequests=true Weaviate__RequestLoggingLevel=Debug dotnet test --logger "console;verbosity=detailed"Available levels: Trace, Debug, Information, Warning, Error, Critical
Create src/Weaviate.Client.Tests/appsettings.Test.json:
{
"Weaviate": {
"LogRequests": true,
"RequestLoggingLevel": "Information"
}
}Note: Environment variables override file-based configuration. Use the hierarchical key format: Weaviate__LogRequests=true (double underscore separates sections).
Use the detailed console logger to see captured output:
dotnet test --logger "console;verbosity=detailed"Logged requests appear in the "Standard Output Messages" section of each test:
Standard Output Messages:
info: Weaviate.Client.Internal.HttpLoggingHandler[0]
HTTP GET http://localhost:8080/v1/meta
info: Weaviate.Client.Internal.HttpLoggingHandler[0]
-> 200 in 15ms
Do not enable request logging in CI or normal test runs. This keeps logs clean and only outputs requests/responses when needed for debugging.