Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display the value of layer.id on validation #8455

Open
tristen opened this issue Jul 10, 2019 · 1 comment
Open

Display the value of layer.id on validation #8455

tristen opened this issue Jul 10, 2019 · 1 comment

Comments

@tristen
Copy link
Member

tristen commented Jul 10, 2019

Right now - If I write a bad value for a filter - the errors returned look like this:

Screen Shot 2019-07-10 at 4 35 27 PM

Displaying the array index layer[125] is less helpful if I'm writing a style in a text editor or my style is compiled from a bunch of layer scripts into one stylesheet.

It would be very helpful if the name of the layer (in this case a layer I've named transit-station-label was displayed. Then I would have string to search / I could quickly identify the mistake I've made in authoring.

@asheemmamoowala
Copy link
Contributor

The specific instance that can be fixed for this error is:

errors = errors.concat(validateElement({
key: (key ? `${key}.` : key) + objectKey,
value: object[objectKey],
valueSpec: elementSpec,
style,
styleSpec,
object,
objectKey
}, object));

The validation logic is pretty generic, and requires special casing the error message generation to use an id field when available. Ideally, the use of the layer.id can be applied to all layer fields, and not just the filter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants