autorest.az
autorest.az copied to clipboard
PLR marketplace: strange flattened parameter name
swagger: https://github.com/changlong-liu/azure-rest-api-specs/tree/20210210-marketplace/specification/marketplace/resource-manager
for private store id defined in https://github.com/Azure/azure-rest-api-specs/blob/master/specification/marketplace/resource-manager/Microsoft.Marketplace/stable/2020-01-01/Marketplace.json#L588
the generated CLI parameter is :
Looks it should be "--private-store-properties-private-store-id" instead of "--private-store-properties-private-store-id-private-store-id" ?
This is modelerfour original behavior of handling parameter name conflict during flatten. There is actually two private-store-id in this operation after flatten. the second one while is flattened from the privateStoreProperties has a flattenedName array ['privateStoreProperties', 'privateStoreId'].
What modelerfour does to resolve such kind of conflict is simple put all the items in flattenedNames in front of the parameter's original name.
you can also find the same behavior if you set body x-ms-client-flatten as true and run the following command
autorest --modelerfour --use=@autorest/[email protected] --output-artifact=code-model-v4-no-tags ../azure-rest-api-specs/specification/marketplace/resource-manager/readme.md --debug --output-folder=/tmp/aztest --modelerfour.flatten-payloads=true --modelerfour.flatten-models=true
move to backlog as this is designed by m4