[C# - aspnetcore] 'pattern' specification generated code regular expression is wrong
Created by: grmcdorman
Description
For a parameter specification similar to the following:
{
"name": "ID",
"in": "path",
"description": "ID",
"required": true,
"type": "string",
"pattern": "[0-9a-f]{8}"
}
the resulting action has a parameter decorated (correctly) with [FromRoute][Required]
; however, the RegularExpression is incorrect:
[RegularExpression("/[0-9a-f]{8}/")]
The leading and trailing slashes are treated literally, i.e. they must (incorrectly) appear in the parameter value.
openapi-generator version
main; I do not know if this is a regression.
OpenAPI declaration file content or url
{
"name": "ID",
"in": "path",
"description": "ID",
"required": true,
"type": "string",
"pattern": "[0-9a-f]{8}"
}
Command line used for generation
java -jar "openapi-generator-cli.jar" generate -i $GenApiPath -g aspnetcore -o $CodeDirectory -c $Parameters
Steps to reproduce
Generate with the above parameter specification.