Skip to content

Commit

Permalink
chore: parse escaped double colon (\\:) example struct tag (#1402)
Browse files Browse the repository at this point in the history
* chore: parse escaped double colon (\\:) example struct tag

Replaces the regular string splitting by a ":" made during
the "example" tag parsing so that it will not split escaped
double colons, allowing string examples containing a double
colon to be escaped using double backlashes.

* refactor: use strings.SplitN to split the string by the first double colon found

Co-authored-by: Gustavo <gustavo.antoniassi@ifood.com.br>
  • Loading branch information
GusAntoniassi and Gustavo committed Nov 29, 2022
1 parent a10fb9a commit 8139731
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion parser.go
Expand Up @@ -1441,7 +1441,7 @@ func defineTypeOfExample(schemaType, arrayType, exampleValue string) (interface{
result := map[string]interface{}{}

for _, value := range values {
mapData := strings.Split(value, ":")
mapData := strings.SplitN(value, ":", 2)

if len(mapData) == 2 {
v, err := defineTypeOfExample(arrayType, "", mapData[1])
Expand Down

0 comments on commit 8139731

Please sign in to comment.