Azure / autorest.powershell

AutoRest PowerShell Generator
MIT License
112 stars 78 forks source link

Support double quote in pattern #1110

Open YanaXu opened 1 year ago

YanaXu commented 1 year ago

Description

The Swagger API is sqlvm.json. The relative part in Swagger API is:

"SqlVirtualMachineNameParameter": {
      "name": "sqlVirtualMachineName",
      "in": "path",
      "description": "Name of the SQL virtual machine.",
      "required": true,
      "type": "string",
      "maxLength": 64,
      "minLength": 1,
      "pattern": "^((?!_)[^\\\\/\"'\\[\\]:|<>+=;,?*@&]{1,64}(?<![.-]))$",
      "x-ms-parameter-location": "method"
    }

I configure the README.md as below:

branch: 0e20dd2e4e2a40e83840c30cce2efc4847fd9cb9
require:
# readme.azure.noprofile.md is the common configuration file
  - $(this-folder)/../readme.azure.noprofile.md
  - $(repo)/specification/sqlvirtualmachine/resource-manager/readme.md

try-require: 
  - $(repo)/specification/sqlvirtualmachine/resource-manager/readme.powershell.md

I run autorest and build-module.ps1. There is a bug in generated\api\SqlVirtualMachineManagementClient.cs.

await eventListener.AssertRegEx(nameof(sqlVirtualMachineName),sqlVirtualMachineName,@"^((?!_)[^\\/"'\[\]:|<>+=;,?*@&]{1,64}(?<![.-]))$");

The correct pattern value should be with 2 double quotes.

@"^((?!_)[^\\/""'\[\]:|<>+=;,?*@&]{1,64}(?<![.-]))$"