Description
The C# HTTP client emitter cannot pass the http/encode/boolean Spector scenarios. A model property declared as @encode(string) value: boolean is generated as a C# bool, but its JSON serialization ignores the string encoding and writes a JSON boolean.
Reproduction
From packages/http-client-csharp on current main:
pwsh eng/scripts/Test-Spector.ps1 -filter "http/encode/boolean"
Exercise the generated typed methods with new BoolAsStringProperty(true/false) for these scenarios:
Property/trueLower
Property/falseLower
Property/trueUpper
Property/falseMixed
All four requests receive HTTP 400 from Spector.
Generated behavior
BoolAsStringProperty.Serialization.cs currently emits:
writer.WritePropertyName("value"u8);
writer.WriteBooleanValue(Value);
The scenarios require string values ("true", "false", "TRUE", and "FaLsE") in both the request and response bodies. Deserialization likewise needs to honor the boolean string encoding.
Expected behavior
The generated serialization and deserialization should respect @encode(string) for boolean model properties so the http/encode/boolean Spector scenarios pass.
Description
The C# HTTP client emitter cannot pass the
http/encode/booleanSpector scenarios. A model property declared as@encode(string) value: booleanis generated as a C#bool, but its JSON serialization ignores the string encoding and writes a JSON boolean.Reproduction
From
packages/http-client-csharpon currentmain:Exercise the generated typed methods with
new BoolAsStringProperty(true/false)for these scenarios:Property/trueLowerProperty/falseLowerProperty/trueUpperProperty/falseMixedAll four requests receive HTTP 400 from Spector.
Generated behavior
BoolAsStringProperty.Serialization.cscurrently emits:The scenarios require string values (
"true","false","TRUE", and"FaLsE") in both the request and response bodies. Deserialization likewise needs to honor the boolean string encoding.Expected behavior
The generated serialization and deserialization should respect
@encode(string)for boolean model properties so thehttp/encode/booleanSpector scenarios pass.