Skip to content

Conversation

@Joxit
Copy link
Member

@Joxit Joxit commented Feb 16, 2021

I was testing pelias/schema#475 and I found a bug (introduced by me 😞) when we use the new pelias-schema.

When ${placeType}_source is not set explicitly, the model will return [ null ].

This is annoying because when we use _.get(place, `${placeType}_source`, ['whosonfirst']) it will return [ null ] because the array is not undefined...
And when we use _.get(place, `${placeType}_source[0]`, 'whosonfirst') it will return null and not the default value because null is not undefined (see lodash doc) 😞.

I fixed all tests for pelias-model 9.0.0 and added a new one

fixes #1515

Copy link
Member

@missinglink missinglink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 happy to merge this, are we waiting on feedback from #1515 or are we good to go?

@Joxit
Copy link
Member Author

Joxit commented Feb 23, 2021

Good to go, I tried with old schema and new schema with pelias-model 9.0.0

The PR is linked with the issue

@orangejulius
Copy link
Member

Nice, thanks for fixing :)

@orangejulius orangejulius merged commit de97774 into master Feb 23, 2021
@orangejulius orangejulius deleted the joxit/fix/normalizeParentIds branch February 23, 2021 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError exception if parent source is null

4 participants