Closed MartinM85 closed 1 month ago
I think that net462 is used in tests projects, because xunit runner doesn't support .netstandard2.x
The tests should run fine for both netfx462 and net8
Any reason why are GetEnumValue and GetCollectionOfEnumValues defined explicitly in FormParseNode?
No, it was probably the auto-suggestion from vscode at the time
Still one opened question:
Is it expected that FormSerializationWriter.WriteAnyValue
writes array as string?
new byte[] { 2, 4, 6 }
is serialized as System.Byte%5B%5D
Still one opened question: Is it expected that
FormSerializationWriter.WriteAnyValue
writes array as string?new byte[] { 2, 4, 6 }
is serialized asSystem.Byte%5B%5D
I think the challenge here is there is no agreed upon and standardized way to represent by arrays for the form of mediatype. This is probably why we don't do anything specific here and it ends up being the dotnet representation of this type. Would it be better to base64 encode it instead?
This probably says it all....
The application/x-www-form-urlencoded format is in many ways an aberrant monstrosity, the result of many years of implementation accidents and compromises leading to a set of requirements necessary for interoperability, but in no way representing good design practices.
Still one opened question: Is it expected that
FormSerializationWriter.WriteAnyValue
writes array as string?new byte[] { 2, 4, 6 }
is serialized asSystem.Byte%5B%5D
I think the challenge here is there is no agreed upon and standardized way to represent by arrays for the form of mediatype. This is probably why we don't do anything specific here and it ends up being the dotnet representation of this type. Would it be better to base64 encode it instead?
I was asking because FormSerializationWriter.WriteAnyValue writes IEnumerable, but not an array
I was asking because FormSerializationWriter.WriteAnyValue writes IEnumerable, but not an array
I believe arrays implement IEnumerable
.
Is it expected that FormSerializationWriter.WriteAnyValue writes array as string?
One thing to note is that WriteAnyValue
is private and not publicly exposed. It is therefore always called from a "nested" perspective (you'll probably be serializing a property of an object) . Given that that Form Serialization doesn't really support nested objects, the method will always write primitives.
What we could probably do is add a case for the byte []
that will base64 encode it as @baywet suggested.
I was asking because FormSerializationWriter.WriteAnyValue writes IEnumerable, but not an array
I believe arrays implement
IEnumerable
.
array implements IEnumerable, but case
is for IEnumerable
Yes it was probably a matter of the type assertion engine not matching in this case and just adding a new one so it explicitly matches. I can see that you have already done that. Thank you for making the change
fixes #280 fixes https://github.com/microsoft/kiota-dotnet/issues/283
Unit tests discovered several issues:
FormSerializationWriter.WriteAnyValue
writes array as string TestWriteAdditionalData_AreWrittenCorrectly()
{ "prop12", new byte[] { 2, 4, 6 } }
is serialized asprop12=System.Byte%5B%5D
Time
class has two constructorsTextParseNode.GetTimeValue
parsesDateTime
value from string and callsTime(DateTime)
ctor. In this case theDate
property ofDateTime
contains current date. If you create a new instance ofTime
by callingTime(int hour, int minute, int second)
ctor as part of unit test, thenDate
property has year, month and day set to 1. When a unit test is created,Assert.Equal
will fail, because it compares alsoDateTime
properties, which can be different. I would suggest to get rid ofDateTime
property andTime(DateTime)
fromTime
. Seems to me better than overridden Equals method.Issue
JsonSerializer.Serialize
insideJsonSerializationWriter.WriteFloatValue
andJsonSerializationWriter.WriteDoubleValue
serialize for .net462. Unit tests fail DoubleFloat
I think that net462 is used in tests projects, because xunit runner doesn't support .netstandard2.x
GetEnumValue
andGetCollectionOfEnumValues
defined explicitly inFormParseNode
?