Skip to content

[containerapp] Fix datetime.date serialization error in az containerapp update --yaml - #9979

Draft
Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-containerapp-yaml-update-exception
Draft

[containerapp] Fix datetime.date serialization error in az containerapp update --yaml#9979
Aditya Pujara (a0x1ab) with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-containerapp-yaml-update-exception

Conversation

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

az containerapp update --yaml raised 'datetime.date' object has no attribute '__dict__' when the YAML file contained bare date values (e.g. 2024-01-01). Python's YAML parser produces datetime.date objects for such values, but the default_handler in _object_to_dict only handled datetime.datetime.

Changes

  • azext_containerapp/_utils.py: Added a local override of _object_to_dict whose default_handler catches both datetime.date and datetime.datetime, serializing them via .isoformat().
  • containerapp_decorator.py, containerapp_job_decorator.py, containerapp_resiliency_decorator.py, daprcomponent_resiliency_decorator.py, custom.py: Switched _object_to_dict import from the core CLI module to the local extension ._utils.
  • tests/latest/test_utils.py: Added unit tests covering datetime.date, datetime.datetime, and plain dict round-trip via _object_to_dict.

Related command

az containerapp update --yaml

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (azdev required; see .azure-pipelines/templates/azdev_setup.yml for the install command until azdev==0.2.11b1 is on PyPI)
  • My extension version conforms to the Extension version schema

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

@azure-client-tools-bot-prd

Copy link
Copy Markdown
Validation for Breaking Change Starting...

Thanks for your contribution!

@azure-client-tools-bot-prd

Copy link
Copy Markdown

Hi Copilot,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

Copilot AI changed the title [WIP] Fix containerapp update with YAML file resulting in exception [containerapp] Fix datetime.date serialization error in az containerapp update --yaml Jun 22, 2026
@yonzhan

Copy link
Copy Markdown
Collaborator

containerapp

@a0x1ab Aditya Pujara (a0x1ab) added azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent and removed azure-client-tools-agent Pull request commented on or reviewed by Azure Client Tools Agent labels Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot ContainerApp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants