Skip to content

Rename TimeSpan scalar to Duration#9340

Merged
glen-84 merged 1 commit intomainfrom
gai/rename-time-span-to-duration
Mar 9, 2026
Merged

Rename TimeSpan scalar to Duration#9340
glen-84 merged 1 commit intomainfrom
gai/rename-time-span-to-duration

Conversation

@glen-84
Copy link
Copy Markdown
Member

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

Summary of the changes (Less than 80 chars)

  • Rename TimeSpan scalar to Duration.

Copilot AI review requested due to automatic review settings March 9, 2026 16:04
@github-actions github-actions Bot added 📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate 🌶️ strawberry shake labels Mar 9, 2026
Copy link
Copy Markdown
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 renames the TimeSpan GraphQL scalar type to Duration throughout the entire Hot Chocolate and Strawberry Shake codebase to align with the ISO 8601 specification naming and move away from .NET-specific terminology.

Changes:

  • Renames the TimeSpanType/TimeSpanSerializer/TimeSpanFormat classes and enums to DurationType/DurationSerializer/DurationFormat across HotChocolate Core, Data, MongoDb, StrawberryShake Client, and CodeGeneration.
  • Updates the ScalarNames and BuiltInScalarNames constants, filter types, dependency injection registrations, and all related test snapshots/resources.
  • Adds a migration guide entry for v15→v16 with a backwards-compatibility workaround.

Reviewed changes

Copilot reviewed 195 out of 197 changed files in this pull request and generated no comments.

Show a summary per file
File Description
website/.../migrate-from-15-to-16.md Documents the scalar rename and provides backwards-compatibility guidance
src/HotChocolate/Core/src/Types/Types/Scalars/ScalarNames.cs Replaces TimeSpan constant with Duration
src/HotChocolate/Core/src/Types/Types/Scalars/DurationFormat.cs Renames TimeSpanFormat enum to DurationFormat
src/HotChocolate/Core/src/Types/Types/Scalars/Scalars.cs Updates scalar lookup tables to use DurationType
src/HotChocolate/Core/src/Types/Properties/TypeResources.resx Renames resource key from TimeSpanType_Description to DurationType_Description
src/HotChocolate/Data/src/Data/Filters/Types/DurationOperationFilterInputType.cs Renames filter input type class and its configured name
src/HotChocolate/Data/src/Data/Filters/Convention/Extensions/FilterConventionDescriptorExtensions.cs Updates TimeSpan runtime type bindings to use DurationOperationFilterInputType
src/HotChocolate/MongoDb/src/Data/Filters/Convention/Extensions/MongoDbFilterConventionDescriptorExtensions.cs Updates MongoDB filter bindings similarly
src/StrawberryShake/Client/src/Core/Serialization/DurationSerializer.cs Renames class from TimeSpanSerializer to DurationSerializer
src/StrawberryShake/Client/src/Core/Serialization/DurationFormat.cs Renames TimeSpanFormat to DurationFormat in StrawberryShake
src/StrawberryShake/Client/src/Core/Serialization/BuiltInScalarNames.cs Replaces TimeSpan with Duration
src/StrawberryShake/Client/src/Core/ThrowHelper.cs Renames error helper methods
src/StrawberryShake/CodeGeneration/src/CodeGeneration/BuiltInScalarNames.cs Updates built-in scalar name list
src/StrawberryShake/CodeGeneration/src/CodeGeneration/TypeNames.cs Renames serializer constant
src/StrawberryShake/CodeGeneration/src/CodeGeneration/TypeInfos.cs Updates type info dictionary key
src/StrawberryShake/CodeGeneration/src/CodeGeneration/Utilities/SchemaHelper.cs Updates default scalar info registration
src/StrawberryShake/CodeGeneration/src/CodeGeneration.CSharp/Generators/DependencyInjectionGenerator.cs Updates DI serializer registration list
Test snapshots (many files) Updates generated code snapshots to reflect DurationSerializer
Adapter tests & resources Updates MCP/OpenAPI test schemas, queries, and snapshots
src/Nitro/CommandLine/src/CommandLine/Generated/ApiClient.Client.cs Updates generated client code
Files not reviewed (1)
  • src/HotChocolate/Core/src/Types/Properties/TypeResources.Designer.cs: Language not supported

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

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

Labels

📚 documentation This issue is about working on our documentation. 🌶️ hot chocolate 🌶️ strawberry shake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants