Support arbitrary expressions on "requires" property
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
_From @davidtheclark on October 4, 2016 2:7_
I'm thinking about:
- https://github.com/mapbox/mapbox-gl-style-spec/issues/497, in which enum values are changed from an array to an object to allow for additional metadata on each value)
- https://github.com/mapbox/mapbox-gl-style-spec/pull/495, in which a `<=` key shows up on an object in the `"requires"` array.
- https://github.com/mapbox/mapbox-gl-style-spec/issues/504, in which we had to allow the value of an object in the `"requires"` array to itself be an array.
- The weirdness of having keys in objects represent either a property name or an operator (`"!"`).
- The weirdness of having items in the `"requires"` array be sometimes strings and sometimes objects.
- The complexity caused by that weirdness in some Studio code I've been looking into.
- https://github.com/mapbox/mapbox-gl-style-spec/issues/499, which is about validating the `"requires"` values — with validation code that will have to deal with the above.
So I'm wondering if it might be worthwhile to reconsider the current format of the `"requires"` value, changing it to something that can be more consistent and robust.
How about this: The value of `"requires"` is always an array of objects, each object with these properties:
- `property` (required): The required property name.
- `operator` (optional): An operator pertaining to the property (e.g. `"!"`, `"<="`).
- `values` (optional): An array of objects representing satisfactory values for the specified property, each object with these properties:
- `value` (required): The satisfactory value.
- `operator` (optional): An operator pertaining to the value. For example, maybe you in the future we'll want to specify that some property must have any value other than `0`, or any value greater than `0`.
The main principle here is that an object is going to be more flexible and future-proof than a string.
That's my idea.
_Copied from original issue: mapbox/mapbox-gl-style-spec#513_
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
The issue identifies no files, tests, or entry points. Start by reviewing the linked style-spec issues and pull request to understand the existing requires formats and validation concerns. Done would require an agreed replacement format and a defined implementation scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100