-
Notifications
You must be signed in to change notification settings - Fork 319
Add Spector scenarios for EncodeDuration with larger unit durations #8729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Spector scenarios for EncodeDuration with larger unit durations #8729
Conversation
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
...lient-csharp/generator/TestProjects/Spector.Tests/Http/Encode/Duration/EncodeDurationTest.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
|
@copilot please follow the instructions here - https://github.com/microsoft/typespec/blob/main/.github/prompts/testserver-generation.md#required-steps-all-must-be-completed-in-order. Specifically, the validation instructions. |
.../generator/http-client-generator-test/src/test/java/encode/duration/EncodeDurationTests.java
Outdated
Show resolved
Hide resolved
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com>
Followed validation instructions in 18f42c9. All validation steps passed:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
All changed packages have been documented.
|
Fixes the issue by adding new Spector test scenarios for duration encoding where the duration value is several minutes, demonstrating that language implementations should use the largest possible unit when constructing duration primitives.
Changes
New Test Scenarios Added
Added 12 new test scenarios across Header, Property, and Query namespaces:
Documentation
All new scenarios include explicit documentation stating:
This guidance ensures language implementations construct duration values idiomatically (e.g.,
TimeSpan.FromMinutes(2)in C# orDuration.ofMinutes(2)in Java) rather than always using the encoded unit (e.g.,TimeSpan.FromSeconds(120)).Files Modified
packages/http-specs/specs/encode/duration/main.tsp- Added 12 operations and 4 modelspackages/http-specs/specs/encode/duration/mockapi.ts- Added 12 mock API scenariospackages/http-specs/spec-summary.md- Auto-generated documentation for new scenariosWire Format
The wire format remains unchanged - durations are still encoded as integers or floats in seconds or milliseconds as specified. The new scenarios document how language SDKs should construct the duration values in memory before encoding.
Validation
All validation steps from the testserver generation guidelines have been completed successfully:
pnpm buildpnpm validate-mock-apispnpm cspellpnpm formatpnpm lintpnpm regen-docsFixes #8728
Original prompt
Fixes #8728
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.