GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Incorrect Serialization Format for defaultDuration in BookingService · Issue #1262 · microsoftgraph/msgraph-sdk-python Open Labels type:bugA broken experienceA broken experience DescriptionDescribe the bugThe According to the Microsoft Graph API documentation for BookingService, the However, the SDK currently serializes Python Relevant Code: File: msgraph/generated/models/booking_service.py writer.write_timedelta_value("defaultDuration", self.default_duration) File: kiota_serialization_json/json_serialization_writer.py def write_timedelta_value(self, key: Optional[str], value: Optional[timedelta]) -> None: if isinstance(value, timedelta): if key: self.writer[key] = str(value) # <-- Incorrect format else: self.value = str(value) Expected behavior
How to reproduceCreate a Serialize the object. Observe that the serialized value for SDK Version1.33.0 Latest version known to work for scenario above?No response Known WorkaroundsCurrently manually patching the serialize method to use correct serialization from datetime import timedelta from isodate import duration_isoformat from kiota_abstractions.serialization.serialization_writer import SerializationWriter from msgraph.generated.models.booking_service import BookingService def patch_booking_service(booking_service: BookingService) -> None: old_serializer = booking_service.serialize def booking_service_serializer_patch(writer: SerializationWriter) -> None: old_serializer(writer) if isinstance(booking_service.default_duration, timedelta): writer.writer["defaultDuration"] = duration_isoformat(booking_service.default_duration) booking_service.serialize = booking_service_serializer_patch Debug outputClick to expand logMainError(additional_data={}, code='UnknownError', details=None, inner_error=InnerError(additional_data={}, client_request_id='08e4b63d-43c0-42aa-a8ed-c42fc75cbf2a', date=datetime.datetime(2025, 6, 16, 20, 47, 57), odata_type=None, request_id='3e28d869-8972-4636-a6f6-6cc0a126bee5'), message='{"type":"https://tools.ietf.org/html/rfc9110#section-15.5.1","title":"One or more validation errors occurred.","status":400,"errors":{"":["The input was not valid."]},"traceId":"00-3e28d86989724636a6f66cc0a126bee5-3b0ff72f47b6692f-01"}', target=None) ConfigurationSDK Version: Latest (as of writing) Python Version: 3.11+ Endpoint: /solutions/bookingBusinesses/{id}/services Other informationProposed Fix from isodate import duration_isoformat def write_iso8601_duration(self, key: Optional[str], value: Optional[timedelta]) -> None: """ Writes a timedelta as an ISO 8601 duration string (e.g., P1DT2H3M4S). """ if isinstance(value, timedelta): duration = duration_isoformat(value) if key: self.writer[key] = duration else: self.value = duration Then update BookingService to call this new method explicitly: File: @dataclass class BookingService(Entity, Parsable): ... def serialize(self, writer: SerializationWriter) -> None: ... # Use the custom method for ISO 8601 durations if hasattr(writer, "write_iso8601_duration"): writer.write_iso8601_duration("defaultDuration", self.default_duration) else: writer.write_timedelta_value("defaultDuration", self.default_duration) # Fallback Activity
MetadataMetadataLabelstype:bugA broken experienceA broken experience TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |