|
| 1 | +# Contributing to Weaviate C# Client |
| 2 | + |
| 3 | +This document provides guidelines for contributing to the Weaviate C# client. |
| 4 | + |
| 5 | +## Public API Tracking |
| 6 | + |
| 7 | +This project uses [Microsoft.CodeAnalysis.PublicApiAnalyzers](https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md) to track changes to the public API surface. This ensures that breaking changes are intentional and reviewed. |
| 8 | + |
| 9 | +### How It Works |
| 10 | + |
| 11 | +The analyzer tracks public API members in two files located in `src/Weaviate.Client/`: |
| 12 | + |
| 13 | +| File | Purpose | |
| 14 | +|------|---------| |
| 15 | +| `PublicAPI.Shipped.txt` | APIs that have been released in a published version | |
| 16 | +| `PublicAPI.Unshipped.txt` | APIs that are new/changed since the last release | |
| 17 | + |
| 18 | +### When Adding New Public APIs |
| 19 | + |
| 20 | +When you add a new public class, method, property, or other member, you'll see an **RS0016** warning at build time: |
| 21 | + |
| 22 | +``` |
| 23 | +warning RS0016: Symbol 'YourNewMethod' is not part of the declared public API |
| 24 | +``` |
| 25 | + |
| 26 | +**To fix this:** |
| 27 | + |
| 28 | +1. Use the IDE quick-fix (lightbulb icon) to add the symbol to `PublicAPI.Unshipped.txt` |
| 29 | +2. Or run `dotnet format analyzers --diagnostics RS0016` to auto-fix all missing entries |
| 30 | + |
| 31 | +### When Modifying or Removing Public APIs |
| 32 | + |
| 33 | +If you change or remove a public API member, you'll see an **RS0017** warning: |
| 34 | + |
| 35 | +``` |
| 36 | +warning RS0017: Symbol 'OldMethod' is part of the declared API, but could not be found |
| 37 | +``` |
| 38 | + |
| 39 | +This is intentional - it alerts you to a potential **breaking change**. Before proceeding: |
| 40 | + |
| 41 | +1. Consider if the change is backward-compatible |
| 42 | +2. If removing/changing is intentional, update the corresponding line in `PublicAPI.Unshipped.txt` |
| 43 | +3. Document the breaking change in the changelog |
| 44 | + |
| 45 | +### Release Process |
| 46 | + |
| 47 | +When preparing a release: |
| 48 | + |
| 49 | +1. Review all entries in `PublicAPI.Unshipped.txt` |
| 50 | +2. Move the entries to `PublicAPI.Shipped.txt` |
| 51 | +3. Clear `PublicAPI.Unshipped.txt` (keeping only `#nullable enable`) |
| 52 | + |
| 53 | +### Suppressed Warnings |
| 54 | + |
| 55 | +The following analyzer warnings are currently suppressed in the project: |
| 56 | + |
| 57 | +| Warning | Reason | |
| 58 | +|---------|--------| |
| 59 | +| RS0026 | Multiple overloads with optional parameters (API design advisory) | |
| 60 | +| RS0027 | Optional parameter ordering (API design advisory) | |
| 61 | +| RS0041 | Oblivious reference types (nullability advisory) | |
| 62 | + |
| 63 | +These are design recommendations, not API tracking issues. They may be addressed in future refactoring efforts. |
| 64 | + |
| 65 | +## Building the Project |
| 66 | + |
| 67 | +```bash |
| 68 | +# Build the main library |
| 69 | +dotnet build src/Weaviate.Client/Weaviate.Client.csproj |
| 70 | + |
| 71 | +# Build and run tests |
| 72 | +dotnet test src/Weaviate.Client.Tests/Weaviate.Client.Tests.csproj |
| 73 | +``` |
| 74 | + |
| 75 | +## Running Tests |
| 76 | + |
| 77 | +The test project includes both unit tests and integration tests. Integration tests require a running Weaviate instance. |
| 78 | + |
| 79 | +```bash |
| 80 | +# Run all tests |
| 81 | +dotnet test |
| 82 | + |
| 83 | +# Run only unit tests |
| 84 | +dotnet test --filter "Category!=Integration" |
| 85 | +``` |
0 commit comments