Esri / arcgis-rest-js

compact, modular JavaScript wrappers for the ArcGIS REST API
https://developers.arcgis.com/arcgis-rest-js/
Apache License 2.0
353 stars 121 forks source link

Geocoding postal code type #1094

Closed cyatteau closed 1 year ago

cyatteau commented 1 year ago

Description

Jim Barry brought to my attention that the postal code parameter should be wrapped in quotes as it is an alphanumeric value. Issues arise when using a postal code starting with zero as demonstrated in these CodePen examples (ex1, ex2).

Several places state or use a number instead of a string, which need to be addressed:

Link to page

https://developers.arcgis.com/arcgis-rest-js/api-reference/arcgis-rest-geocoding/IGeocodeOptions#postal

gavinr commented 1 year ago

@cyatteau @JimBarry thanks much for reporting this. This definitely seems like it should be a string. I think the code change would go here: https://github.com/Esri/arcgis-rest-js/blob/c4f62d806facb9d74f8c64c6579e7b94388d57aa/packages/arcgis-rest-geocoding/src/geocode.ts#L33-L34 ... (and then maybe elsewhere to get the unit tests working). Would you be able to submit a PR for this? Thanks!

patrickarlt commented 1 year ago

@gavinr I think we should accept numbers OR strings here and maybe warn if someone passes a number?

This isn't a breaking change since the number just gets serialized to a string on the POST body or query string.