validate property names in getPaintProperty
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
`map.setPaintProperty(layer, key value)` validates arguments but `map.getPaintProperty` does not. Providing a bad property key will trigger an internal error. It should trigger an error with a helpful errror message. Seen here: https://github.com/mapbox/mapbox-gl-js/issues/6030
**mapbox-gl-js version**: v0.43.0 and master
### Steps to Trigger Behavior
1. `map.getPaintProperty("background", "fill-radius");`
### Expected Behavior
something like:
`"fill-radius" is not a paint property background layers"`
### Actual Behavior
`Uncaught TypeError: Cannot read property 'value' of undefined`
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the map.getPaintProperty entry point and compare its argument handling with map.setPaintProperty, using the reported background and fill-radius call as the reproduction. Verify that an invalid property produces a helpful validation error rather than the internal TypeError; the issue is done when this behavior is covered and working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100