msgraph-sdk-php
msgraph-sdk-php copied to clipboard
JSON serialization does not encode DateTime of RecurrenceRange correct
I'm again looking into the JSON serialization of models. I came across a bug in the RecurrenceRange serialization. The API allows the start and end dates to be strings in the format 'Y-m-d', but the model serializes to DateTime::RFC3339 (equal to 'Y-m-d\TH:i:sP'). With this bug the API will not allow any request send with a serialization of a RecurrenceRange in it and you have to fix the request payload manually. I'm willing to fix this bug again in the Code Generator, but I'm not sure if it would be better to fix this directly in the RecurrencePattern Class. Hope you can help me with this.
Code Snippet in Microsoft\Graph\Model\Entity.php referring to this:
if (is_a($val, "\DateTime")) { $serializableProperties[$property] = $val->format(\DateTime::RFC3339); }
Thanks for reporting this @Dakoni4400. Looking into this
@Dakoni4400 the fix would have to be made in the Code Generator because of other models that require the Date type. I appreciate your willingness to take this on however the team has had some discussion around this and we feel it will be easier if we worked on the bug fix
I'll tag you on the PRs
This has been resolved in v2.0 of this SDK. Kindly consider upgrading.