Repository navigation
feat(json): move the JSON converters into the package FSharp.Azure.Cosmos.Json - #73
xperiandri wants to merge 1 commit into
Conversation
…osmos.Json` The converters do not use the Azure Cosmos DB SDK, but the package of the library for the API for NoSQL depends on the SDK. Thus a project that uses the converters from that package also depends on the SDK. A client of the API for Gremlin can use `TimeSpanTicksConverter`, but it does not use the SDK. The new project `src/Cosmos.Json` makes the package `FSharp.Azure.Cosmos.Json`. It contains `JsonConverters.fs` without a change and depends only on `FSharp.Core`. `FSharp.Azure.Cosmos` references the new project. Thus its package depends on `FSharp.Azure.Cosmos.Json` of the same version. The namespace of the converter does not change. Thus the code that uses the converter does not change. No released package contains `TimeSpanTicksConverter`. Thus a type forwarder is not necessary. The tests of the converter are in `tests/Cosmos.Tests` as before. They use the new assembly through the reference to `FSharp.Azure.Cosmos`, and the emulator tests of the converter use the client of that library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the extraction of the converter into a standalone JSON package.
No open issues 🎉
What changed in this PR
Extracts TimeSpanTicksConverter into FSharp.Azure.Cosmos.Json, allowing clients such as future Gremlin libraries to use it without depending on the Azure Cosmos DB SDK.
Changes:
- Moves the converter unchanged into a standalone package while preserving its namespace.
- Adds a project reference so existing
FSharp.Azure.Cosmosconsumers retain access to the converter. - Updates solution files and documentation for the new package.
| File | Description |
|---|---|
src/Cosmos/FSharp.Azure.Cosmos.fsproj |
References the new project instead of compiling the converter directly. |
src/Cosmos.Json/JsonConverters.fs |
Relocates the converter without changing its behavior. |
src/Cosmos.Json/FSharp.Azure.Cosmos.Json.fsproj |
Defines the standalone JSON converter package. |
src/Cosmos.Json/AssemblyInfo.fs |
Supplies assembly metadata for the new library. |
README.md |
Adds NuGet badges for the new package. |
FSharp.Azure.Cosmos.slnx |
Includes the JSON project in the solution. |
FSharp.Azure.Cosmos.slnf |
Includes the JSON project in the solution filter. |
docsSrc/How_Tos/Store_Durations.md |
Explains standalone and transitive access to the converter. |
CHANGELOG.md |
Records the new package and converter location. |
.github/copilot-instructions.md |
Documents the JSON project in the solution tree. |
Review effort: Balanced
Summary
TimeSpanTicksConvertermoves fromFSharp.Azure.Cosmosinto a new package,FSharp.Azure.Cosmos.Json. The new package depends only onFSharp.Core. Thus a project can use the converter without the Azure Cosmos DB SDK.Cause
This is the first step of the plan for the Gremlin libraries (
FSharp.GremlinandFSharp.Azure.Cosmos.Gremlin). A client of the API for Gremlin also writes aTimeSpanas a number of ticks, because Cosmos DB sorts a number in time order, but not the text that System.Text.Json writes. But such a client does not use the SDK of the API for NoSQL. In the packageFSharp.Azure.Cosmos, each project that uses the converter also depends on that SDK.Change
src/Cosmos.Json/FSharp.Azure.Cosmos.Json.fsprojhasAssemblyInfo.fsandJsonConverters.fs. Git recordsJsonConverters.fsas moved without a change (R100).src/Cosmos/FSharp.Azure.Cosmos.fsprojreferences the new project. Thus the packageFSharp.Azure.Cosmosdepends onFSharp.Azure.Cosmos.Jsonof the same version.FSharp.Azure.Cosmosas before. Thus code that opens this namespace does not change.README.md, the solution tree in.github/copilot-instructions.md, the how-to pageStore_Durations.mdand the entry inCHANGELOG.mdshow the new package.Not necessary
TimeSpanTicksConverter. Its entry inCHANGELOG.mdis in[Unreleased].tests/Cosmos.Testsas before. They use the converter through the reference toFSharp.Azure.Cosmos.Checks
dotnet packwith the version2.0.0-local: the packageFSharp.Azure.Cosmosdepends onFSharp.Azure.Cosmos.Json 2.0.0-local. The packageFSharp.Azure.Cosmos.Jsondepends only onFSharp.Core 10.0.100and containsFSharp.Azure.Cosmos.Json.dlland its XML documentation.BuildDocs) passes. The reference page ofTimeSpanTicksConverternames the assemblyFSharp.Azure.Cosmos.Json.dll.ExistsAsync returns the result for its own id when called concurrently, withTooManyRequests (429)from the emulator. The same test fails in the same way on the code ofmain. Thus the cause is the emulator, not this change.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
FSharp.Azure.Cosmos.Jsonpackage, providing JSON converters without requiring the Azure Cosmos DB SDK.TimeSpanTicksConverterwrites durations as JSON numbers while continuing to read the previous text representation.FSharp.Azure.Cosmospackage now includes the converter package.Documentation