Filter validation doesn't invalidate single boolean value
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
It looks like single boolean values are passing validation but results in invalid GL JSON. 🤔 It's not immediately clear why. [`getType` should be accounting for it](https://github.com/mapbox/mapbox-gl-js/blob/922d7b38c0466181fa6f0cebbec1e013ae59d475/src/style-spec/validate/validate_filter.js#L25-L27).
**mapbox-gl-style-spec version**: `13.2.1`
### Steps to Trigger Behavior
```js
import validateFilter from '@mapbox/mapbox-gl-style-spec/validate/validate_filter';
import styleSpec from '@mapbox/mapbox-gl-style-spec/reference/v8.json';
const errors = validateFilter({
key: '',
style: { glyphs: 'fake' },
styleSpec,
value: false
});
// []
```
### Expected Behavior
An entry in the error array indicating the boolean value provided is an invalid filter value.
### Actual Behavior
An empty error array returns resulting in no error found.
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 in src/style-spec/validate/validate_filter.js at the getType logic linked by the issue, then reproduce the supplied validateFilter call with value: false. Update validation so the call returns an error for the boolean value, and verify that the error array is no longer empty.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100