You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@grmcdorman thanks for reporting the issue. I've filed #1371 to fix the issue and my test result looks good without the forward slashes:
[Route("/v2/pet/{petId}")]
[ValidateModelState]
[SwaggerOperation("UpdatePetWithForm")]
- public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long? petId, [FromForm]string name, [FromForm]string status)+ public virtual IActionResult UpdatePetWithForm([FromRoute][Required]long? petId, [FromForm][RegularExpression("[0-9a-f]{8}")]string name, [FromForm]string status)
{
//TODO: Uncomment the next line to return response 405 or use other options such as return this.NotFound(), return this.BadRequest(..), ...
Description
For a parameter specification similar to the following:
the resulting action has a parameter decorated (correctly) with
[FromRoute][Required]
; however, the RegularExpression is incorrect: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
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.
Related issues/PRs
Suggest a fix/enhancement
The text was updated successfully, but these errors were encountered: