mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.04k stars 2.21k forks source link

Add requires field for root level properties in the spec #11174

Open tristen opened 2 years ago

tristen commented 2 years ago

Properties like terrain and fog are not supported if projection.name is anything other than mercator. Should documented properties like https://github.com/mapbox/mapbox-gl-js/blob/1333ef17ac2a047d3f7c916566fd078579eb5292/src/style-spec/reference/v8.json#L64-L67

be written with this?

"fog": { 
 "type": "fog", 
 "doc": "A global effect that fades layers and markers based on their distance to the camera. The fog can be used to approximate the effect of atmosphere on distant objects and enhance the depth perception of the map when used with terrain or 3D features.",
  "requires": [
    {
      "projection": {
        "name": "mercator"
      }
    }
  ]
}
karimnaaji commented 2 years ago

@tristen by making that change, would you also expect that the combination fog/non-mercator, terrain/non-mercator to issue a style-spec validation error?

tristen commented 2 years ago

@karimnaaji I think whatever is consistent with how required fields on paint/layout properties? I believe that's just a documented requirement and not a validation error?