Skip to content

feat(json): move the JSON converters into the package FSharp.Azure.Cosmos.Json - #73

Open
xperiandri wants to merge 1 commit into
mainfrom
feat/cosmos-json-package
Open

xperiandri wants to merge 1 commit into
mainfrom
feat/cosmos-json-package

Conversation

@xperiandri

@xperiandri xperiandri commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

TimeSpanTicksConverter moves from FSharp.Azure.Cosmos into a new package, FSharp.Azure.Cosmos.Json. The new package depends only on FSharp.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.Gremlin and FSharp.Azure.Cosmos.Gremlin). A client of the API for Gremlin also writes a TimeSpan as 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 package FSharp.Azure.Cosmos, each project that uses the converter also depends on that SDK.

Change

  • The new project src/Cosmos.Json/FSharp.Azure.Cosmos.Json.fsproj has AssemblyInfo.fs and JsonConverters.fs. Git records JsonConverters.fs as moved without a change (R100).
  • src/Cosmos/FSharp.Azure.Cosmos.fsproj references the new project. Thus the package FSharp.Azure.Cosmos depends on FSharp.Azure.Cosmos.Json of the same version.
  • The namespace of the converter is FSharp.Azure.Cosmos as before. Thus code that opens this namespace does not change.
  • The two solution files, the package table in README.md, the solution tree in .github/copilot-instructions.md, the how-to page Store_Durations.md and the entry in CHANGELOG.md show the new package.

Not necessary

  • A type forwarder: no released package contains TimeSpanTicksConverter. Its entry in CHANGELOG.md is in [Unreleased].
  • A new test project: the 31 tests of the converter are in tests/Cosmos.Tests as before. They use the converter through the reference to FSharp.Azure.Cosmos.

Checks

  • The Debug build of the solution filter has no error and no new warning.
  • dotnet pack with the version 2.0.0-local: the package FSharp.Azure.Cosmos depends on FSharp.Azure.Cosmos.Json 2.0.0-local. The package FSharp.Azure.Cosmos.Json depends only on FSharp.Core 10.0.100 and contains FSharp.Azure.Cosmos.Json.dll and its XML documentation.
  • The strict documentation build (BuildDocs) passes. The reference page of TimeSpanTicksConverter names the assembly FSharp.Azure.Cosmos.Json.dll.
  • The whole test suite on the Windows emulator: 292 of 293 tests pass, the 31 tests of the converter included. The one failure is ExistsAsync returns the result for its own id when called concurrently, with TooManyRequests (429) from the emulator. The same test fails in the same way on the code of main. Thus the cause is the emulator, not this change.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added the FSharp.Azure.Cosmos.Json package, providing JSON converters without requiring the Azure Cosmos DB SDK.
    • The TimeSpanTicksConverter writes durations as JSON numbers while continuing to read the previous text representation.
    • The existing FSharp.Azure.Cosmos package now includes the converter package.
  • Documentation

    • Updated package listings and duration-storage guidance, including how to use the converters without the Azure Cosmos DB SDK.

…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>
@xperiandri
xperiandri requested a balanced review from Copilot November 8, 2026 00:41
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The JSON converters now build as a separate .NET 10 package. The existing Cosmos project references that package instead of compiling the converters directly. Solution files, package listings, and documentation identify the new package.

Changes: JSON converter package

Layer / File(s) Summary
Define the JSON converter package
src/Cosmos.Json/FSharp.Azure.Cosmos.Json.fsproj, src/Cosmos.Json/AssemblyInfo.fs
A new .NET 10 project packages JsonConverters.fs as FSharp.Azure.Cosmos.Json. It defines assembly metadata, release settings, compile items, and SourceLink configuration.
Wire the package into the solution
src/Cosmos/FSharp.Azure.Cosmos.fsproj, FSharp.Azure.Cosmos.slnf, FSharp.Azure.Cosmos.slnx, CHANGELOG.md, README.md, docsSrc/How_Tos/Store_Durations.md, .github/copilot-instructions.md
The Cosmos project references the new package and no longer compiles JsonConverters.fs. The solution files and package documentation list or describe the package.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: Minimal · up to 8a8d3

The converter is extracted into a separate package, and no merge-blocking risk was identified.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the JSON converters (TimeSpanTicksConverter) move into a new package, FSharp.Azure.Cosmos.Json. The raw summary confirms a new Cosmos.Json project, the removal of Json…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the JSON converters (TimeSpanTicksConverter) move into a new package, FSharp.Azure.Cosmos.Json. The raw summary confirms a new Cosmos.Json project, the removal of JsonConverters.fs from the FSharp.Azure.Cosmos compile list, and a project reference to the new package. The title is specific and matches the changeset and the stated PR objectives. The 'feat(json):' prefix is a conventional-commit style and does not hurt clarity.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (9 skipped: 9 unsupported.)

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2cb9f9da-267e-4b5c-8e9d-ee5b4fb74526
Commits

Reviewing files that changed from the base of the PR and between ef5d60b and 8a8d379.

Files selected for processing: 10

  • .github/copilot-instructions.md
  • CHANGELOG.md
  • FSharp.Azure.Cosmos.slnf
  • FSharp.Azure.Cosmos.slnx
  • README.md
  • docsSrc/How_Tos/Store_Durations.md
  • src/Cosmos.Json/AssemblyInfo.fs
  • src/Cosmos.Json/FSharp.Azure.Cosmos.Json.fsproj
  • src/Cosmos.Json/JsonConverters.fs
  • src/Cosmos/FSharp.Azure.Cosmos.fsproj

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.Cosmos consumers 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants