Skip to content

Add TimeSpan alias for Duration scalar to Strawberry Shake#9401

Merged
glen-84 merged 2 commits intomainfrom
gai/issue-9392
Mar 20, 2026
Merged

Add TimeSpan alias for Duration scalar to Strawberry Shake#9401
glen-84 merged 2 commits intomainfrom
gai/issue-9392

Conversation

@glen-84
Copy link
Member

@glen-84 glen-84 commented Mar 20, 2026

Summary of the changes (Less than 80 chars)

  • Add TimeSpan alias for Duration scalar to Strawberry Shake.

Closes #9392

Copilot AI review requested due to automatic review settings March 20, 2026 10:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses Strawberry Shake scalar code generation by treating the GraphQL TimeSpan scalar as a built-in alias of Duration, so generated C# models use System.TimeSpan instead of string (per #9392).

Changes:

  • Added TimeSpan as a default/built-in scalar mapping to System.TimeSpan.
  • Registered TimeSpan as a DurationType alias in schema building for codegen.
  • Added a new scalar generator test and snapshot for TimeSpan.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/SchemaHelper.cs Adds default leaf type info for TimeSpan and registers DurationType("TimeSpan") alias.
src/StrawberryShake/CodeGeneration/src/CodeGeneration/BuiltInScalarNames.cs Marks TimeSpan as a built-in scalar name for schema loading/codegen decisions.
src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/ScalarGeneratorTests.cs Adds a test case verifying TimeSpan scalar generation.
src/StrawberryShake/CodeGeneration/test/CodeGeneration.CSharp.Tests/snapshots/ScalarGeneratorTests.TimeSpan_Type.snap Snapshot of the expected generated client code for TimeSpan.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84 glen-84 merged commit 536e621 into main Mar 20, 2026
124 checks passed
@glen-84 glen-84 deleted the gai/issue-9392 branch March 20, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TimeSpan generated as String

2 participants