Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.55k stars 2.77k forks source link

Python management api call begin_create_or_update converts string type value '1.01' to a string '2024-01-01' in the response example and timezone gets lost #37562

Open rsteeghs-enx opened 6 hours ago

rsteeghs-enx commented 6 hours ago

Describe the bug Hi,

We use 'azure-mgmt-apimanagement==4.0.1' python library in our CICD pipeline:

To create or update an api revision we use from '_api_operations.py' .venv/Lib/site-packages/azure/mgmt/apimanagement/operations/_api_operations.py the method on line 801:

def begin_create_or_update self, resource_group_name: str, service_name: str, api_id: str, parameters: Union[_models.ApiCreateOrUpdateParameter, IO[bytes]], if_match: Optional[str] = None, **kwargs: Any

During debug session we took the content of the 'swagger.json' file, attached to this case, from inside this 'begin_create_or_update' method. So this is the api specifiction already inside the 'azure-mgmt-apimanagement==4.0.1' python library. And this one is equal to the used api specification with which we started the CICD pipeline.

When the 'begin_create_or_update' finishes. We see another result in Azure APIM for this api.

Differences are in de operations response examples for every occurance of the field 'DocumentDate' and the 'ProcessReference/ID' For 'DocumentDate' the 'Z' timezone indicator is stripped so expected values '2019-02-26T06:54:48Z' become '2019-02-26T06:54:48' For 'ProcessReference/ID' the value is converted totally from '1.01' to '2024-01-01'.

For the 'DocumentDate' the 'Z' is also stripped in the example in the definition 'CustomerRequestHeaderType/DocumentDate'. For the 'ProcessReference/ID' the anomaly does not occur in de definition for this one in 'ProcessReferenceType/ID'.

For reference I attached the swagger api spec which we took from APIM and attached it as 'faulty-apim-swagger.json' to this case. Just do a diff on both attached files and the problem is visible.

So our opinion is that inside the 'azure-mgmt-apimanagement==4.0.1' python library is something not correct which make this unexpected changes.

Please investigate and fix or give advise if we need to change something.

Thanks and kind regards,

Ronald Steeghs

swagger.json faulty-apim-swagger.json

To Reproduce Use the mentioned library version with the input and see what happens.

Expected behavior We expect the content of input swagger to match what is created in Azure APIM

Screenshots Not available

Additional context Not available

github-actions[bot] commented 6 hours ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @miaojiang.