fix(csharp): emit millisecond precision for nullable datetime params in mock tests#16019
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
Closes FER-10694
Summary
Generated C# mock-server tests for nullable date-time query/header parameters were producing
WithParam("since", "2024-01-15T09:30:00Z")(no millis) while the SDK runtime serializesDateTimewithyyyy-MM-ddTHH:mm:ss.fffKand actually sends2024-01-15T09:30:00.000Z. WireMock requires exact match → 404.Root cause:
getDateTimeinMockEndpointGenerator.tsonly unwrappedcontainer.optional. When the IR wraps a date-time incontainer.nullable(common withrespect-nullable-schemas: true+coerce-optional-schemas-to-nullable: false), it returnedundefinedand the test fell back to the rawvalue.jsonExamplestring, which omits millis.Example
Found while debugging
auth0-teams-csharp-sdkCI:Activity.ListTestfailed withAuth0.TeamsApiException : Error with status code 404. The IR for thesinceparameter walked ascontainer.optional → container.nullable → named.alias → primitive.datetime. Thenullablestep short-circuited the recursion.Before/after for that generated test:
Fix:
Test plan
pnpm turbo run compile --filter @fern-api/fern-csharp-sdk— cleanpnpm turbo run test --filter @fern-api/fern-csharp-sdk— 41/41 passdotnet test --filter FullyQualifiedName~Activity.ListTestnow passes 2/2 (was 0/2)Zform, so no fixture churn expected🤖 Generated with Claude Code