1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-28 08:47:55 +02:00

added oauth2 jsvm name exception

This commit is contained in:
Gani Georgiev
2024-10-09 18:47:19 +03:00
parent 4d44f1cb5c
commit 0a60cdfde6
5 changed files with 16 additions and 1 deletions

View File

@@ -29,7 +29,13 @@ func (u FieldMapper) MethodName(_ reflect.Type, m reflect.Method) string {
return convertGoToJSName(m.Name)
}
var nameExceptions = map[string]string{"OAuth2": "oauth2"}
func convertGoToJSName(name string) string {
if v, ok := nameExceptions[name]; ok {
return v
}
startUppercase := make([]rune, 0, len(name))
for _, c := range name {

View File

@@ -25,6 +25,7 @@ func TestFieldMapper(t *testing.T) {
{"ALL_CAPS_WITH_UNDERSCORE", "all_caps_with_underscore"},
{"OIDCMap", "oidcMap"},
{"MD5", "md5"},
{"OAuth2", "oauth2"},
}
for i, s := range scenarios {