@mapbox/mapbox-gl-style-spec 13.20.0 → 13.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 13.20.1
2
+
3
+ ### 🐞 Bug fixes
4
+
5
+ * Increase strictness of the style API validation for source types ([#10779](https://github.com/mapbox/mapbox-gl-js/pull/10779))
6
+ * Remove strictly-increasing requirement for fog range validation ([#10772](https://github.com/mapbox/mapbox-gl-js/pull/10772))
7
+
1
8
  ## 13.20.0
2
9
 
3
10
  ### ✨ Features and improvements
package/dist/index.cjs CHANGED
@@ -14150,9 +14150,6 @@
14150
14150
  errors = errors.concat([new ValidationError('fog', fog, `object expected, ${ rootType } found`)]);
14151
14151
  return errors;
14152
14152
  }
14153
- if (fog.range && !isExpression(deepUnbundle(fog.range)) && fog.range[0] >= fog.range[1]) {
14154
- errors = errors.concat([new ValidationError('fog', fog, 'fog.range[0] can\'t be greater than or equal to fog.range[1]')]);
14155
- }
14156
14153
  for (const key in fog) {
14157
14154
  const transitionMatch = key.match(/^(.*)-transition$/);
14158
14155
  if (transitionMatch && fogSpec[transitionMatch[1]] && fogSpec[transitionMatch[1]].transition) {
@@ -14994,6 +14991,11 @@
14994
14991
  });
14995
14992
  return errors;
14996
14993
  }
14994
+ const acceptedSourceTypes = new Set([
14995
+ 'vector',
14996
+ 'raster',
14997
+ 'raster-dem'
14998
+ ]);
14997
14999
  function getSourceErrors(source, i) {
14998
15000
  const errors = [];
14999
15001
  const sourceKeys = [
@@ -15002,9 +15004,12 @@
15002
15004
  'tileSize'
15003
15005
  ];
15004
15006
  errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
15007
+ if (!acceptedSourceTypes.has(String(source.type))) {
15008
+ errors.push(new ValidationError(`sources[${ i }].type`, source.type, `Expected one of [${ Array.from(acceptedSourceTypes).join(', ') }]`));
15009
+ }
15005
15010
  const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
15006
- if (!isValid(source.url, sourceUrlPattern)) {
15007
- errors.push(new ValidationError(`sources[${ i }]`, source.url, 'Source url must be a valid Mapbox tileset url'));
15011
+ if (!source.url || !isValid(source.url, sourceUrlPattern)) {
15012
+ errors.push(new ValidationError(`sources[${ i }].url`, source.url, 'Expected a valid Mapbox tileset url'));
15008
15013
  }
15009
15014
  return errors;
15010
15015
  }