-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Validation of "format" expression fails when options are provided #8271
Comments
I started a branch with a currently-failing test fixture: |
@jseppi Hi, I'm super new and I tried to follow all the associated library version upgrades, but I don't have enough context to understand all the teams and software components that needed updates or were updated. I can dig in on this, it will just take me a few tries and some time (and gaining a bunch of context that I need eventually anyway). Is it correct that the |
@ahk Apologies for any confusion on my part, and thanks for taking a look!
No, that is the bug that this issue is reporting. The
The expressions mentioned in that comment ( |
Hey there @ahk - checking on any progress here |
Hi @jseppi, I got some help from @asheemmamoowala and found the root cause for this issue. It's all about the Javascript quirk that |
mapbox-gl-js-style-spec version:
13.7.0
(also tested against versions from13.1.0
onward)Steps to Trigger Behavior
Clone this repo, cd to
src/style-spec/
, runnpm install
andnpm run build
Use the
gl-style-validate
to validate a style that has a text-filed"format"
expression, such as the one intest/integration/render-tests/text-field/formatted-text-color/style.json
:./bin/gl-style-validate ../../test/integration/render-tests/text-field/formatted-text-color/style.json
Observe an unexpected validation error:
layers[0].layout.text-field[1]: Bare objects invalid. Use ["literal", {...}] instead.
Expected Behavior
Running
gl-style-validate
on a style that contains a text-field"format"
expression containing a valid options object should pass.Actual Behavior
Running
gl-style-validate
on a style that contains a text-field"format"
expression containing results in an error message:layers[0].layout.text-field[1]: Bare objects invalid. Use ["literal", {...}] instead.
If the options are instead changed to be empty objects, then the validation succeeds. For example, if the linked test fixture is modified to have the following
"format"
expression, then the validation succeeds:cc @asheemmamoowala @tristen
The text was updated successfully, but these errors were encountered: