on develop help sign in
Additional edge-cases for OAuth scope naming
commitbdf95b931699d90cfd138616ecea8aa43412c621 authorBrendan Hay <brendan.g.hay@gmail.com> dateTue 22 Mar 2016, 16:49 (11 years ago) parent0da5fdb
2 files changed+9−5
gen/src/Gen/Text.hs+1 gen/src/Gen/Types/Schema.hs+8−5
gen/src/Gen/Text.hs+1
@@ -233,6 +233,7 @@ upperAcronym x = Fold.foldl' (flip (uncurry RE.replaceAll)) x xs
233233 , ("Vpn", "VPN")
234234 , ("Xml", "XML")
235235 , ("Youtube", "YouTube")
236+ , ("youtube", "YouTube")
236237
237238 , ("([^a])data", "$1Data")
238239 , ("([^ypn])load", "$1Load")
gen/src/Gen/Types/Schema.hs+8−5
@@ -437,10 +437,10 @@ serviceName :: Service a -> String
437437serviceName = Text.unpack . (<> "Service") . toCamel . _sCanonicalName
438438
439439scopeName :: Service a -> Text -> String
440−scopeName s k = Text.unpack . lowerHead $
440+scopeName s k = Text.unpack . lowerHead . lowerFirstAcronym $
441441 case breakParts k of
442− [] -> _sCanonicalName s <> "AllScope"
443− xs -> foldMap named xs <> "Scope"
442+ [] -> _sCanonicalName s <> "AllScope"
443+ xs -> foldMap named xs <> "Scope"
444444 where
445445 breakParts =
446446 concatMap (Text.split split)
@@ -465,6 +465,9 @@ scopeName s k = Text.unpack . lowerHead $
465465 lower = Text.toLower (_sCanonicalName s)
466466
467467 special =
468− [ ("only", "Only")
469− , ("manage", "Manage")
468+ [ ("only", "Only")
469+ , ("manage", "Manage")
470+ , ("devstorage", "Storage")
471+ , ("number", "Number")
472+ , ("^yt$", "youtube")
470473 ]