-
Notifications
You must be signed in to change notification settings - Fork 2
Accept lowercase country codes in JSON Schema #1302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
daniel-myparcel
wants to merge
2
commits into
develop
from
bugfix/MP-8335-lowercase-country-code-accepted-as-path-param
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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)." | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the heebie jeebies from this enum and am wondering why we're doing all this work in the specification.
The bug report is caused by the issue that our API forwards the path parameter without making it uppercase.
The minimal fix for this would be a
strtoupper()in the API and we're done, or am I overlooking something?It's nice to make the regex an enum, but I think we should leave that as the only change in this PR.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. The ticket title says the issue is
[api-specification] lowercase country code acceptedwhich insinuates the bug is in the spec (since we also use it to validate the request body).Now that I read the ticket again getting an empty response as the ticket mentions menas it does infact pass validation and so this is not the bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that even if this doesn't fix an actual bug in the flow we might want to keep this for semantic purposes.
The Spec does accepts lowercase country codes so having it reflected in the Spec is arguably logical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/MyParcelCOM/api/pull/4313