mapbox / mapbox/mapbox-gl-js

Color validation doesn't evaluate channel values

Open
#6,467 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

It looks like invalid color values are passing validation!

**mapbox-gl-style-spec version**: `11.1.1`

### Steps to Trigger Behavior

```js
import validateProperty from '@mapbox/mapbox-gl-style-spec/validate/validate_property'
import styleSpec from '@mapbox/mapbox-gl-style-spec/reference/v8.json'

const errors = validateProperty({
key: '',
layerType: 'line',
objectKey: 'line-color',
style: { glyphs: 'fake' },
value: 'hsl(, 100%, 59%)', // There's no value for hue here
styleSpec,
valueSpec: styleSpec['paint_line']['line-color']
}, 'paint');

// []

```

### Expected Behavior

An entry in the error array indicating the color value did not pass validation.

### Actual Behavior

An empty error array returns resulting in no error found.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided validateProperty reproduction against mapbox-gl-style-spec 11.1.1, then trace validation from validate/validate_property through the line-color value specification. The fix is done when a missing hue produces an error entry instead of an empty array, with regression coverage for this invalid color value.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.