You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling a request that specifies FormData as the type and has fields that can be Option types, when specifying a value like Some true or Some 6 it is actually sending the whole option as a string to the API like Some(true) and Some(6) instead of just true or 6.
Example
letformData= MyProvider.OperationTypes.UpdateItem_formData()
formData.Name <-"My name"
formData.SomeFieldThatExpectsABool <- Some true
formData.SomeFieldThatExpectsANumber <- Some 6let!res= client.UpdateItem(formData)
Intrestingly, it works as expected when specifying the Provider like this OpenApiClientProvider<Schema, PreferNullable=true> (with PreferNullable) but then I have to use Nullable true or Nullable 6 and it'll send to API as expected, but with Option types it does not.
This is on version 2.0.0-beta6
Repro steps
Have a provider that needs a form data request and field that exposes as an Option
Set the value of the Option to something like Some 6 or whatever the option type needs
See the backend receive the value as Some(6) instead of just 6
Expected behavior
The option type value should be unwrapped before sending to API if it's Some and should be null if None
Actual behavior
The option type value is not unwrapped before sending to API
Known workarounds
Use PreferNullable=true instead, that works
Affected Type Providers
SwaggerClientProvider
OpenApiClientProvider (I only tested with this one)
Related information
Operating system Mac OS Montery
Branch
.NET Runtime, CoreCLR or Mono Version net6.0
Performance information, links to performance testing scripts
The text was updated successfully, but these errors were encountered:
Description
When calling a request that specifies FormData as the type and has fields that can be Option types, when specifying a value like
Some true
orSome 6
it is actually sending the whole option as a string to the API likeSome(true)
andSome(6)
instead of justtrue
or6
.Example
Intrestingly, it works as expected when specifying the
Provider
like thisOpenApiClientProvider<Schema, PreferNullable=true>
(with PreferNullable) but then I have to useNullable true
orNullable 6
and it'll send to API as expected, but with Option types it does not.This is on version
2.0.0-beta6
Repro steps
Some 6
or whatever the option type needsSome(6)
instead of just6
Expected behavior
The option type value should be unwrapped before sending to API if it's Some and should be null if None
Actual behavior
The option type value is not unwrapped before sending to API
Known workarounds
Use
PreferNullable=true
instead, that worksAffected Type Providers
Related information
Mac OS Montery
net6.0
The text was updated successfully, but these errors were encountered: