-
-
Notifications
You must be signed in to change notification settings - Fork 344
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
feat!: no implicit default for optional params #3361
Conversation
7197ec2
to
361c9d2
Compare
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
361c9d2
to
7f80ce5
Compare
|
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/3361 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v3.0 #3361 +/- ##
==========================================
+ Coverage 98.24% 98.28% +0.03%
==========================================
Files 321 323 +2
Lines 14687 14772 +85
Branches 2334 2345 +11
==========================================
+ Hits 14429 14518 +89
Misses 116 116
+ Partials 142 138 -4 ☔ View full report in Codecov by Sentry. |
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
This PR changes behavior of parameters that are typed in a union with `None`. Prior behavior was to implicitly default their value to `None` if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst. New behavior is to throw a client error when a parameter without a default is not provided.
Description
None
. Prior behavior was to implicitly default their value toNone
if a value wasn't provided making an apparently non-optional parameter (i.e., no declared default) actually optional. Surprising behavior at best, dangerous at worst.New behavior is to throw a client error when a parameter without a default is not provided.
Closes
Closes #2518