Fix for GeoJSON
output erroneously producing an Array for the postalcode
field.
#1684
+195
−9
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.
This PR fixes an issue with the
GeoJSON
output which is erroneously producing an Array for thepostalcode
field for some records (ie. only those with aliases)This was a tricky bug to track down, it's a combination of this cast which has been around for 9 years combined with some more modern work which triggered it.
We have some logic to 'flatten' array values to strings in the API codebase (
helper/fieldValue.js
), but what's happening here is that the Array coming back from elasticsearch is being wrapped in a second array,getStringValue()
only flattens a single level.The rest of this PR is me adding tests to try and understand what
middleware/renamePlacenames
did, and then renaming it to make it clearer what exactly it does 🤷https://pelias.github.io/compare/#/v1/search?text=kinkerstraat+175F