[Repo Assist] test: extend DateOnly/TimeOnly type-mapping coverage (+7 tests, 317→324)#397
Merged
sergey-tihon merged 3 commits intomasterfrom Apr 23, 2026
Conversation
Add the tests that were missing after PRs #393 and #394 landed: * required date → DateOnly when useDateOnly=true * optional date → Option<DateOnly> when useDateOnly=true * optional time → Option<TimeOnly> when useDateOnly=true * PreferNullable+useDateOnly: optional DateOnly → Nullable<DateOnly> * PreferNullable+useDateOnly: required DateOnly stays unwrapped * PreferNullable+useDateOnly: optional TimeOnly → Nullable<TimeOnly> * PreferNullable+useDateOnly: required TimeOnly stays unwrapped Also expose compilePropertyTypeWithNullableAndDateOnly helper in Schema.TestHelpers for the PreferNullable×useDateOnly combination. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the SwaggerProvider test suite to cover the missing DateOnly/TimeOnly type-mapping cases introduced by recent useDateOnly support in DefinitionCompiler, including PreferNullable combinations.
Changes:
- Add missing schema type-mapping tests for
format: date/format: timewhenuseDateOnly=true(required + optional). - Add
PreferNullable=true×useDateOnly=truetests to ensure optionalDateOnly/TimeOnlyare wrapped asNullable<T>. - Expose a new schema test helper to compile property types with both
provideNullable=trueanduseDateOnly=true.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/SwaggerProvider.Tests/Schema.TypeMappingTests.fs | Adds 7 tests covering DateOnly/TimeOnly mapping and PreferNullable wrapping behavior under useDateOnly=true. |
| tests/SwaggerProvider.Tests/Schema.TestHelpers.fs | Adds compilePropertyTypeWithNullableAndDateOnly helper to compile schemas with PreferNullable and useDateOnly enabled together. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Agent-Logs-Url: https://github.com/fsprojects/SwaggerProvider/sessions/564a5cd8-95fa-4822-8a43-a8e1132ed123 Co-authored-by: sergey-tihon <1197905+sergey-tihon@users.noreply.github.com>
Contributor
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. 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:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Adds 7 type-mapping tests that were missing after PRs #393 and #394 introduced
DateOnly/TimeOnlysupport. These tests exercise the full matrix ofuseDateOnly=truescenarios inDefinitionCompiler.New tests
required date+useDateOnly=trueDateOnlyoptional date+useDateOnly=trueOption<DateOnly>optional time+useDateOnly=trueOption<TimeOnly>PreferNullable+optional date+useDateOnly=trueNullable<DateOnly>PreferNullable+required date+useDateOnly=trueDateOnly(no wrapping)PreferNullable+optional time+useDateOnly=trueNullable<TimeOnly>PreferNullable+required time+useDateOnly=trueTimeOnly(no wrapping)Also exposes
compilePropertyTypeWithNullableAndDateOnlyhelper inSchema.TestHelpers.fsfor theprovideNullable=true×useDateOnly=truecombination.Root cause of the gap
PR #394 (TimeOnly support) focused on the
format: timepath and itsrequired/optionalcoverage, but did not add the correspondingDateOnlyrequired test or thePreferNullable×useDateOnlyvariants.Test Status
✅ All 324 unit tests pass (
317 → 324, +7 new, 0 failed)