autorest.typescript
autorest.typescript copied to clipboard
The autorest option `azureArm` will return true if no azure-arm or openapi-type defined
Bug
The autorest option azureArm
extracting from method getIsAzureArm
in autorestOptions.ts
will return true if no azure-arm or openapi-type defined with below code snippet:
async function getIsAzureArm(host: AutorestExtensionHost): Promise<boolean> {
const flag = (await host.getValue("azure-arm")) === true;
const openapi = (await host.getValue("openapi-type")) === "arm";
return flag || openapi;
}
Expected Behavior
The calling await host.getValue("azure-arm")
should not be true if no azure-arm
provided as input.
Following on this:
@joheredi and I faced this issue to while regenerating keyvault-certificates
a couple of days ago. We debugged the generator and found that if the openapi-type
flag is not present in the config file, the default value would be "arm".
Specifying openapi-type = "data-plane"
fixes this behavior. Changing azure-arm
to false didn't change the openapi type default value.
This default value seems to be coming from the Modeler 4.
@timotheeguerin do you recall if M4 has "arm" as default value for openapi-type
?
Autorest core has openapi-type
set to arm
by default. Not really sure why those 2 flags exist really but not sure what we can change without breaking all uses now.
Thanks, @timotheeguerin. @sarangan12 I see that checking openapi-type
was introduced in this change. Do you recall why azure-arm
was not sufficient and we need to check openapi-type