Skip to content

Commit

Permalink
phone country code enum dash removed (#28)
Browse files Browse the repository at this point in the history
* 6106 phone country code, phone number, language name 2 and 3 char codes and postal code types

* makefile gen-phone gen-language commands added

* swagger update

* fix travis-ci

* readme update

* swagger + languages/phone generator fixes

* swagger + languages/phone generator fixes

* dial code valuer fix

* travis ci go-lint script update

* postal_code validation fix

* postal_code validation fix

* country unmarshalling empty value fix

* unmarshalling empty value fix

* phone country code enum dash removed

Co-authored-by: ivan-lemiashonak <[email protected]>
  • Loading branch information
ilemiashonak and ilemiashonak authored Oct 28, 2022
1 parent f6b48ed commit 64cf831
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 125 deletions.
8 changes: 4 additions & 4 deletions phone/.generator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ function preparePhoneCountryCodes(rawCodes) {
let codesByCountry = codes[requestCountryDialKey].split(",")
if (codesByCountry.length > 1) {
codesByCountry.forEach(code => {
result.push({ [innerCountryDialKey]: code, [innerCountryKey]: codes[requestCountryKey] })
result.push({ [innerCountryDialKey]: code.replace("-", ""), [innerCountryKey]: codes[requestCountryKey] })
})
} else {
result[result.length] = { [innerCountryDialKey]: codes[requestCountryDialKey], [innerCountryKey]: codes[requestCountryKey] }
result[result.length] = { [innerCountryDialKey]: codes[requestCountryDialKey].replace("-", ""), [innerCountryKey]: codes[requestCountryKey] }
}
}

Expand All @@ -93,7 +93,7 @@ ${renderByAlpha2Codes(trimRedundantDominicana(codes))}
}

function trimRedundantDominicana(codes) {
let redundant = ["1-809", "1-849"]
let redundant = ["1809", "1849"]
return codes.filter(({ [innerCountryDialKey]: dialCode }) => !redundant.some(el => dialCode === el))
}

Expand Down Expand Up @@ -143,7 +143,7 @@ function renderSpecification(codes) {
components: {
schemas: {
DialCountryCode: {
example: "1-829",
example: "1829",
type: "string",
format: "E.164",
enum: [...Object.keys(concatenateCountriesByDialCode(codes))],
Expand Down
94 changes: 47 additions & 47 deletions phone/codes_mapping_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,79 +889,79 @@ var countryCodeByDialString = map[string][]country.Alpha2Code{
"998": {
country.Alpha2Code("UZ"),
},
"1-684": {
country.Alpha2Code("AS"),
},
"1-264": {
country.Alpha2Code("AI"),
},
"1-268": {
country.Alpha2Code("AG"),
},
"1-242": {
"1242": {
country.Alpha2Code("BS"),
},
"1-246": {
"1246": {
country.Alpha2Code("BB"),
},
"1-441": {
country.Alpha2Code("BM"),
"1264": {
country.Alpha2Code("AI"),
},
"1-284": {
"1268": {
country.Alpha2Code("AG"),
},
"1284": {
country.Alpha2Code("VG"),
},
"1-345": {
"1340": {
country.Alpha2Code("VI"),
},
"1345": {
country.Alpha2Code("KY"),
},
"1-767": {
country.Alpha2Code("DM"),
"1441": {
country.Alpha2Code("BM"),
},
"1-809": {
country.Alpha2Code("DO"),
"1473": {
country.Alpha2Code("GD"),
},
"1-829": {
country.Alpha2Code("DO"),
"1649": {
country.Alpha2Code("TC"),
},
"1-849": {
country.Alpha2Code("DO"),
"1664": {
country.Alpha2Code("MS"),
},
"1-473": {
country.Alpha2Code("GD"),
"1670": {
country.Alpha2Code("MP"),
},
"1-671": {
"1671": {
country.Alpha2Code("GU"),
},
"39-06": {
country.Alpha2Code("VA"),
"1684": {
country.Alpha2Code("AS"),
},
"1-876": {
country.Alpha2Code("JM"),
"1721": {
country.Alpha2Code("SX"),
},
"1-664": {
country.Alpha2Code("MS"),
"1758": {
country.Alpha2Code("LC"),
},
"1-670": {
country.Alpha2Code("MP"),
"1767": {
country.Alpha2Code("DM"),
},
"1-869": {
country.Alpha2Code("KN"),
"1784": {
country.Alpha2Code("VC"),
},
"1-758": {
country.Alpha2Code("LC"),
"1809": {
country.Alpha2Code("DO"),
},
"1-784": {
country.Alpha2Code("VC"),
"1829": {
country.Alpha2Code("DO"),
},
"1-721": {
country.Alpha2Code("SX"),
"1849": {
country.Alpha2Code("DO"),
},
"1-868": {
"1868": {
country.Alpha2Code("TT"),
},
"1-649": {
country.Alpha2Code("TC"),
"1869": {
country.Alpha2Code("KN"),
},
"1-340": {
country.Alpha2Code("VI"),
"1876": {
country.Alpha2Code("JM"),
},
"3906": {
country.Alpha2Code("VA"),
},
}
92 changes: 46 additions & 46 deletions phone/dial_code_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ const (
AL = DialCode("355")
// 213 is 'DZ' country dial code
DZ = DialCode("213")
// 1-684 is 'AS' country dial code
AS = DialCode("1-684")
// 1684 is 'AS' country dial code
AS = DialCode("1684")
// 376 is 'AD' country dial code
AD = DialCode("376")
// 244 is 'AO' country dial code
AO = DialCode("244")
// 1-264 is 'AI' country dial code
AI = DialCode("1-264")
// 1264 is 'AI' country dial code
AI = DialCode("1264")
// 672 is 'AQ' country dial code
AQ = DialCode("672")
// 1-268 is 'AG' country dial code
AG = DialCode("1-268")
// 1268 is 'AG' country dial code
AG = DialCode("1268")
// 54 is 'AR' country dial code
AR = DialCode("54")
// 374 is 'AM' country dial code
Expand All @@ -33,14 +33,14 @@ const (
AT = DialCode("43")
// 994 is 'AZ' country dial code
AZ = DialCode("994")
// 1-242 is 'BS' country dial code
BS = DialCode("1-242")
// 1242 is 'BS' country dial code
BS = DialCode("1242")
// 973 is 'BH' country dial code
BH = DialCode("973")
// 880 is 'BD' country dial code
BD = DialCode("880")
// 1-246 is 'BB' country dial code
BB = DialCode("1-246")
// 1246 is 'BB' country dial code
BB = DialCode("1246")
// 375 is 'BY' country dial code
BY = DialCode("375")
// 32 is 'BE' country dial code
Expand All @@ -49,8 +49,8 @@ const (
BZ = DialCode("501")
// 229 is 'BJ' country dial code
BJ = DialCode("229")
// 1-441 is 'BM' country dial code
BM = DialCode("1-441")
// 1441 is 'BM' country dial code
BM = DialCode("1441")
// 975 is 'BT' country dial code
BT = DialCode("975")
// 591 is 'BO' country dial code
Expand All @@ -67,8 +67,8 @@ const (
BR = DialCode("55")
// 246 is 'IO' country dial code
IO = DialCode("246")
// 1-284 is 'VG' country dial code
VG = DialCode("1-284")
// 1284 is 'VG' country dial code
VG = DialCode("1284")
// 673 is 'BN' country dial code
BN = DialCode("673")
// 359 is 'BG' country dial code
Expand All @@ -85,8 +85,8 @@ const (
CM = DialCode("237")
// 1 is 'CA' country dial code
CA = DialCode("1")
// 1-345 is 'KY' country dial code
KY = DialCode("1-345")
// 1345 is 'KY' country dial code
KY = DialCode("1345")
// 236 is 'CF' country dial code
CF = DialCode("236")
// 235 is 'TD' country dial code
Expand Down Expand Up @@ -133,10 +133,10 @@ const (
DK = DialCode("45")
// 253 is 'DJ' country dial code
DJ = DialCode("253")
// 1-767 is 'DM' country dial code
DM = DialCode("1-767")
// 1-829 is 'DO' country dial code
DO = DialCode("1-829")
// 1767 is 'DM' country dial code
DM = DialCode("1767")
// 1829 is 'DO' country dial code
DO = DialCode("1829")
// 593 is 'EC' country dial code
EC = DialCode("593")
// 20 is 'EG' country dial code
Expand Down Expand Up @@ -185,12 +185,12 @@ const (
GR = DialCode("30")
// 299 is 'GL' country dial code
GL = DialCode("299")
// 1-473 is 'GD' country dial code
GD = DialCode("1-473")
// 1473 is 'GD' country dial code
GD = DialCode("1473")
// 590 is 'GP' country dial code
GP = DialCode("590")
// 1-671 is 'GU' country dial code
GU = DialCode("1-671")
// 1671 is 'GU' country dial code
GU = DialCode("1671")
// 502 is 'GT' country dial code
GT = DialCode("502")
// 44 is 'GG' country dial code
Expand All @@ -205,8 +205,8 @@ const (
HT = DialCode("509")
// 672 is 'HM' country dial code
HM = DialCode("672")
// 39-06 is 'VA' country dial code
VA = DialCode("39-06")
// 3906 is 'VA' country dial code
VA = DialCode("3906")
// 504 is 'HN' country dial code
HN = DialCode("504")
// 36 is 'HU' country dial code
Expand All @@ -229,8 +229,8 @@ const (
IL = DialCode("972")
// 39 is 'IT' country dial code
IT = DialCode("39")
// 1-876 is 'JM' country dial code
JM = DialCode("1-876")
// 1876 is 'JM' country dial code
JM = DialCode("1876")
// 81 is 'JP' country dial code
JP = DialCode("81")
// 44 is 'JE' country dial code
Expand Down Expand Up @@ -297,8 +297,8 @@ const (
MN = DialCode("976")
// 382 is 'ME' country dial code
ME = DialCode("382")
// 1-664 is 'MS' country dial code
MS = DialCode("1-664")
// 1664 is 'MS' country dial code
MS = DialCode("1664")
// 212 is 'MA' country dial code
MA = DialCode("212")
// 258 is 'MZ' country dial code
Expand Down Expand Up @@ -327,8 +327,8 @@ const (
NU = DialCode("683")
// 672 is 'NF' country dial code
NF = DialCode("672")
// 1-670 is 'MP' country dial code
MP = DialCode("1-670")
// 1670 is 'MP' country dial code
MP = DialCode("1670")
// 47 is 'NO' country dial code
NO = DialCode("47")
// 968 is 'OM' country dial code
Expand Down Expand Up @@ -373,16 +373,16 @@ const (
BL = DialCode("590")
// 290 is 'SH' country dial code
SH = DialCode("290")
// 1-869 is 'KN' country dial code
KN = DialCode("1-869")
// 1-758 is 'LC' country dial code
LC = DialCode("1-758")
// 1869 is 'KN' country dial code
KN = DialCode("1869")
// 1758 is 'LC' country dial code
LC = DialCode("1758")
// 590 is 'MF' country dial code
MF = DialCode("590")
// 508 is 'PM' country dial code
PM = DialCode("508")
// 1-784 is 'VC' country dial code
VC = DialCode("1-784")
// 1784 is 'VC' country dial code
VC = DialCode("1784")
// 685 is 'WS' country dial code
WS = DialCode("685")
// 378 is 'SM' country dial code
Expand All @@ -401,8 +401,8 @@ const (
SL = DialCode("232")
// 65 is 'SG' country dial code
SG = DialCode("65")
// 1-721 is 'SX' country dial code
SX = DialCode("1-721")
// 1721 is 'SX' country dial code
SX = DialCode("1721")
// 421 is 'SK' country dial code
SK = DialCode("421")
// 386 is 'SI' country dial code
Expand Down Expand Up @@ -449,16 +449,16 @@ const (
TK = DialCode("690")
// 676 is 'TO' country dial code
TO = DialCode("676")
// 1-868 is 'TT' country dial code
TT = DialCode("1-868")
// 1868 is 'TT' country dial code
TT = DialCode("1868")
// 216 is 'TN' country dial code
TN = DialCode("216")
// 90 is 'TR' country dial code
TR = DialCode("90")
// 993 is 'TM' country dial code
TM = DialCode("993")
// 1-649 is 'TC' country dial code
TC = DialCode("1-649")
// 1649 is 'TC' country dial code
TC = DialCode("1649")
// 688 is 'TV' country dial code
TV = DialCode("688")
// 256 is 'UG' country dial code
Expand All @@ -471,8 +471,8 @@ const (
GB = DialCode("44")
// 255 is 'TZ' country dial code
TZ = DialCode("255")
// 1-340 is 'VI' country dial code
VI = DialCode("1-340")
// 1340 is 'VI' country dial code
VI = DialCode("1340")
// 1 is 'US' country dial code
US = DialCode("1")
// 598 is 'UY' country dial code
Expand Down
2 changes: 1 addition & 1 deletion postal_code/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ components:
example: CA6633
type: string
format: postal-code
x-go-type: github.com/mikekonan/go-types/v2/postalcode.PostalCode
x-go-type: github.com/mikekonan/go-types/v2/postal_code.PostalCode
Loading

0 comments on commit 64cf831

Please sign in to comment.