Skip to content

Need to preperly escape regexp pattern #21

@Pilatuz

Description

@Pilatuz

The code generator is unable to handle the following regexp pattern:

"name": {
  "type": "string",
  "pattern": "^[0-9a-zA-Z`]+$"
}

The problem here is in ` (U0060) character. The code generator builds the validation helper as:

"{{ .NameSpace }}Pattern = regexp.MustCompile(`" + pattern + "`)"

and contains incorrect escaped Go string if pattern contains U0060 character inside.
Need to properly escape regexp pattern!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions