From 27d12c7786be8c6070498a956c154628439742ed Mon Sep 17 00:00:00 2001 From: Daniel Verner Date: Wed, 22 Jul 2026 17:05:56 +0200 Subject: [PATCH 1/2] Convert CountryCode to enum for better useability + Add support for lowercase country codes when its user input --- .../parameters/path-country_code.json | 2 +- specification/schemas.json | 3 + .../schemas/addresses/CountryCode.json | 30 +++++++++- .../addresses/CountryCodeUserInput.json | 57 +++++++++++++++++++ 4 files changed, 89 insertions(+), 3 deletions(-) create mode 100644 specification/schemas/addresses/CountryCodeUserInput.json diff --git a/specification/parameters/path-country_code.json b/specification/parameters/path-country_code.json index 474b55a9..9ff60635 100644 --- a/specification/parameters/path-country_code.json +++ b/specification/parameters/path-country_code.json @@ -4,6 +4,6 @@ "description": "Country code in ISO 3166-1 alpha-2 format.", "required": true, "schema": { - "$ref": "#/components/schemas/CountryCode" + "$ref": "#/components/schemas/CountryCodeUserInput" } } diff --git a/specification/schemas.json b/specification/schemas.json index 7c45ff17..7e3ef829 100644 --- a/specification/schemas.json +++ b/specification/schemas.json @@ -152,6 +152,9 @@ "CountryCode": { "$ref": "./schemas/addresses/CountryCode.json" }, + "CountryCodeUserInput": { + "$ref": "./schemas/addresses/CountryCodeUserInput.json" + }, "Currency": { "$ref": "./schemas/Currency.json" }, diff --git a/specification/schemas/addresses/CountryCode.json b/specification/schemas/addresses/CountryCode.json index eb3bc36a..d4764455 100644 --- a/specification/schemas/addresses/CountryCode.json +++ b/specification/schemas/addresses/CountryCode.json @@ -1,6 +1,32 @@ { "type": "string", - "pattern": "^(AD|AE|AF|AG|AI|AL|AM|AO|AQ|AR|AS|AT|AU|AW|AX|AZ|BA|BB|BD|BE|BF|BG|BH|BI|BJ|BL|BM|BN|BO|BQ|BR|BS|BT|BV|BW|BY|BZ|CA|CC|CD|CF|CG|CH|CI|CK|CL|CM|CN|CO|CR|CU|CV|CW|CX|CY|CZ|DE|DJ|DK|DM|DO|DZ|EC|EE|EG|EH|ER|ES|ET|FI|FJ|FK|FM|FO|FR|GA|GB|GD|GE|GF|GG|GH|GI|GL|GM|GN|GP|GQ|GR|GS|GT|GU|GW|GY|HK|HM|HN|HR|HT|HU|ID|IE|IL|IM|IN|IO|IQ|IR|IS|IT|JE|JM|JO|JP|KE|KG|KH|KI|KM|KN|KP|KR|KW|KY|KZ|LA|LB|LC|LI|LK|LR|LS|LT|LU|LV|LY|MA|MC|MD|ME|MF|MG|MH|MK|ML|MM|MN|MO|MP|MQ|MR|MS|MT|MU|MV|MW|MX|MY|MZ|NA|NC|NE|NF|NG|NI|NL|NO|NP|NR|NU|NZ|OM|PA|PE|PF|PG|PH|PK|PL|PM|PN|PR|PS|PT|PW|PY|QA|RE|RO|RS|RU|RW|SA|SB|SC|SD|SE|SG|SH|SI|SJ|SK|SL|SM|SN|SO|SR|SS|ST|SV|SX|SY|SZ|TC|TD|TF|TG|TH|TJ|TK|TL|TM|TN|TO|TR|TT|TV|TW|TZ|UA|UG|UM|US|UY|UZ|VA|VC|VE|VG|VI|VN|VU|WF|WS|XK|YE|YT|ZA|ZM|ZW)$", + "enum": [ + "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", + "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", + "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", + "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", + "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", + "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", + "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", + "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", + "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", + "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", + "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", + "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", + "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", + "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", + "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", + "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", + "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", + "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", + "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", + "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", + "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", + "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", + "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", + "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", + "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW" + ], "example": "GB", - "description": "Country code in ISO 3166-1 alpha-2 format." + "description": "Country code in ISO 3166-1 alpha-2 format (uppercase or lowercase)." } diff --git a/specification/schemas/addresses/CountryCodeUserInput.json b/specification/schemas/addresses/CountryCodeUserInput.json new file mode 100644 index 00000000..b77e627d --- /dev/null +++ b/specification/schemas/addresses/CountryCodeUserInput.json @@ -0,0 +1,57 @@ +{ + "type": "string", + "enum": [ + "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", + "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", + "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", + "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", + "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", + "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", + "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", + "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", + "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", + "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", + "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", + "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", + "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", + "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", + "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", + "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", + "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", + "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", + "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", + "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", + "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", + "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", + "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", + "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", + "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW", + "ad", "ae", "af", "ag", "ai", "al", "am", "ao", "aq", "ar", + "as", "at", "au", "aw", "ax", "az", "ba", "bb", "bd", "be", + "bf", "bg", "bh", "bi", "bj", "bl", "bm", "bn", "bo", "bq", + "br", "bs", "bt", "bv", "bw", "by", "bz", "ca", "cc", "cd", + "cf", "cg", "ch", "ci", "ck", "cl", "cm", "cn", "co", "cr", + "cu", "cv", "cw", "cx", "cy", "cz", "de", "dj", "dk", "dm", + "do", "dz", "ec", "ee", "eg", "eh", "er", "es", "et", "fi", + "fj", "fk", "fm", "fo", "fr", "ga", "gb", "gd", "ge", "gf", + "gg", "gh", "gi", "gl", "gm", "gn", "gp", "gq", "gr", "gs", + "gt", "gu", "gw", "gy", "hk", "hm", "hn", "hr", "ht", "hu", + "id", "ie", "il", "im", "in", "io", "iq", "ir", "is", "it", + "je", "jm", "jo", "jp", "ke", "kg", "kh", "ki", "km", "kn", + "kp", "kr", "kw", "ky", "kz", "la", "lb", "lc", "li", "lk", + "lr", "ls", "lt", "lu", "lv", "ly", "ma", "mc", "md", "me", + "mf", "mg", "mh", "mk", "ml", "mm", "mn", "mo", "mp", "mq", + "mr", "ms", "mt", "mu", "mv", "mw", "mx", "my", "mz", "na", + "nc", "ne", "nf", "ng", "ni", "nl", "no", "np", "nr", "nu", + "nz", "om", "pa", "pe", "pf", "pg", "ph", "pk", "pl", "pm", + "pn", "pr", "ps", "pt", "pw", "py", "qa", "re", "ro", "rs", + "ru", "rw", "sa", "sb", "sc", "sd", "se", "sg", "sh", "si", + "sj", "sk", "sl", "sm", "sn", "so", "sr", "ss", "st", "sv", + "sx", "sy", "sz", "tc", "td", "tf", "tg", "th", "tj", "tk", + "tl", "tm", "tn", "to", "tr", "tt", "tv", "tw", "tz", "ua", + "ug", "um", "us", "uy", "uz", "va", "vc", "ve", "vg", "vi", + "vn", "vu", "wf", "ws", "xk", "ye", "yt", "za", "zm", "zw" + ], + "example": "GB", + "description": "Country code in ISO 3166-1 alpha-2 format (uppercase or lowercase)." +} From 98d156604323694d3678b667aa75754cb466ec70 Mon Sep 17 00:00:00 2001 From: Daniel Verner Date: Tue, 28 Jul 2026 10:46:04 +0200 Subject: [PATCH 2/2] Remove inacurate string description for country code enum --- specification/schemas/addresses/CountryCode.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/schemas/addresses/CountryCode.json b/specification/schemas/addresses/CountryCode.json index d4764455..24d3304a 100644 --- a/specification/schemas/addresses/CountryCode.json +++ b/specification/schemas/addresses/CountryCode.json @@ -28,5 +28,5 @@ "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW" ], "example": "GB", - "description": "Country code in ISO 3166-1 alpha-2 format (uppercase or lowercase)." + "description": "Country code in ISO 3166-1 alpha-2 format." }