Skip to content

Commit

Permalink
Merge pull request #170 from mgenov/helpers_url_check_with_json_name
Browse files Browse the repository at this point in the history
helpers: use JsonName as fallback in urlHasVarsFromMessage
  • Loading branch information
moul authored Jan 23, 2021
2 parents f4bcee5 + c67c233 commit db1b4f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,13 @@ func urlHasVarsFromMessage(path string, d *ggdescriptor.Message) bool {
if strings.Contains(path, fmt.Sprintf("{%s}", *field.Name)) {
return true
}
// JSON name field is checked as fallback. The value set by the protocol compiler.
// If the user has set a "json_name" option on a field, that option's value
// will be used in this check. By default value in this property will be field name in
// camelCase format.
if strings.Contains(path, fmt.Sprintf("{%s}", *field.JsonName)) {
return true
}
}
}

Expand Down

0 comments on commit db1b4f6

Please sign in to comment.