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.58k stars 2.8k forks source link

[API Management Management] Python SDK ocumentation not accurate for export_api #16452

Closed Dvgz65 closed 2 years ago

Dvgz65 commented 3 years ago

Describe the bug Customer Reported the following:

The class ApiExportOperations the get method is supposed to return an Object of type APIExportResult with 3 properties azure.mgmt.apimanagement.models.ApiExportResult

id (str) – ResourceId of the API which was exported.

export_result_format (str or ExportResultFormat) – Format in which the Api Details are exported to the Storage Blob with Sas Key valid for 5 minutes. Possible values include: “swagger-link-json”, “wsdl- link+xml”, “wadl-link-json”, “openapi-link”.

value (ApiExportResultValue) – The object defining the schema of the exported Api Detail.

After running a script we are seeing that export and value properties are reported with none value

{'additional_properties': {'properties': {'format': 'openapi-link', 'value': {'link': 'https://apimstu9tjyndpsbrohlr2pk.blob.core.windows.net/api-export/Echo API.yaml?sv=2017-04-17&sr=b&sig=v0OaBgcE6sFwK55iRFufdBv78dO3mnH95pbxD%2BlrvEc%3D&se=2021-02-01T18:08:59Z&sp=r'}}, 'type': 'Microsoft.ApiManagement/service/apis', 'name': 'echo-api'}, 'id': '/subscriptions//resourceGroups/apimanagement/providers/Microsoft.ApiManagement/service/devasqu2apim/apis/echo-api', 'export_result_format': None, 'value': None}

Instead, there is an additional_properties field which contains the information require when running the export. Complain is why this additional properties is not mentioned in the docs anywhere.

To Reproduce Steps to reproduce the behavior: Create a script to call

result = ApiManagementClient(credentials,subsid).api_export.get(rg, api_service,api, ExportFormat.OPENAPI, ExportApi.TRUE)

Expected behavior We expect to see the export_result_format and value fields with the correct data as it is supposed to be, if this is a bug, then add the additional_properties to the documentation.

Screenshots

Additional context Add any other context about the problem here.

bala-muthugurusamy-by commented 3 years ago

Thanks @Dvgz65

The additional_properties property has not been documented as well

https://azuresdkdocs.blob.core.windows.net/$web/python/azure-mgmt-apimanagement/1.0.0/azure.mgmt.apimanagement.models.html#azure.mgmt.apimanagement.models.ApiExportResult

https://azuresdkdocs.blob.core.windows.net/$web/python/azure-mgmt-apimanagement/1.0.0/azure.mgmt.apimanagement.models.html#azure.mgmt.apimanagement.models.ApiExportResultValue

00Kai0 commented 3 years ago

Hi @Dvgz65 , thanks for your report. I got this issue: image And this additional_properties is in base model. It will not be shown in document.

The problem is that the API does not return the fields defined by the model. It will be fixed in next version :)

00Kai0 commented 3 years ago

And @Dvgz65 please delete the screenshot you show. It exposes the secret, there is a risk of leakage。

Dvgz65 commented 3 years ago

@00Kai0 Do you know if in other SDKs this behavior is the same or this is only specific for Python?

Dvgz65 commented 3 years ago

@00Kai0 I would like to know if there has been any progress on the investigation/resolution of this issue.

ghost commented 2 years ago

Hi @Dvgz65. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

ghost commented 2 years ago

Hi @Dvgz65, since you haven’t asked that we “/unresolve” the issue, we’ll close this out. If you believe further discussion is needed, please add a comment “/unresolve” to reopen the issue.