microsoft / kiota-serialization-json-python

JSON serialization implementation for Kiota clients in Python
https://aka.ms/kiota/docs
MIT License
4 stars 12 forks source link

fix: get_datetime_value fails to serialize empty string #334

Closed pjmagee closed 4 months ago

pjmagee commented 4 months ago

In the ISO 8601 date format (YYYY-MM-DD), the shortest possible valid date string is 10 characters long. Therefore, if the length of the string is less than 10, it cannot be a valid date in this format, and the function can immediately return None without attempting to parse the date, which would be a more expensive operation.

Overview

Brief description of what this PR does, and why it is needed.

Related Issue

Fixes #258

Demo

Optional. Screenshots, curl examples, etc.

Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

Testing Instructions

pjmagee commented 4 months ago

Also wondering, instead of trying to be optimal here with datetime, maybe a try/exception implementation for all the pendulum parsing should happen, and if it works, the type is returned, otherwise None is returned?

sonarcloud[bot] commented 4 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

baywet commented 4 months ago

Actually nevermind the changelog changes, I'll do it myself.

pjmagee commented 4 months ago

Actually nevermind the changelog changes, I'll do it myself.

Thanks! I hadn't seen the messages until now but looks like all is merged already

baywet commented 4 months ago

yes, merged and released