@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/dist/index.es.js CHANGED
@@ -14144,9 +14144,6 @@ function validateFog(options) {
14144
14144
  errors = errors.concat([new ValidationError('fog', fog, `object expected, ${ rootType } found`)]);
14145
14145
  return errors;
14146
14146
  }
14147
- if (fog.range && !isExpression(deepUnbundle(fog.range)) && fog.range[0] >= fog.range[1]) {
14148
- errors = errors.concat([new ValidationError('fog', fog, 'fog.range[0] can\'t be greater than or equal to fog.range[1]')]);
14149
- }
14150
14147
  for (const key in fog) {
14151
14148
  const transitionMatch = key.match(/^(.*)-transition$/);
14152
14149
  if (transitionMatch && fogSpec[transitionMatch[1]] && fogSpec[transitionMatch[1]].transition) {
@@ -14988,6 +14985,11 @@ function getAllowedKeyErrors(obj, keys, path) {
14988
14985
  });
14989
14986
  return errors;
14990
14987
  }
14988
+ const acceptedSourceTypes = new Set([
14989
+ 'vector',
14990
+ 'raster',
14991
+ 'raster-dem'
14992
+ ]);
14991
14993
  function getSourceErrors(source, i) {
14992
14994
  const errors = [];
14993
14995
  const sourceKeys = [
@@ -14996,9 +14998,12 @@ function getSourceErrors(source, i) {
14996
14998
  'tileSize'
14997
14999
  ];
14998
15000
  errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
15001
+ if (!acceptedSourceTypes.has(String(source.type))) {
15002
+ errors.push(new ValidationError(`sources[${ i }].type`, source.type, `Expected one of [${ Array.from(acceptedSourceTypes).join(', ') }]`));
15003
+ }
14999
15004
  const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
15000
- if (!isValid(source.url, sourceUrlPattern)) {
15001
- errors.push(new ValidationError(`sources[${ i }]`, source.url, 'Source url must be a valid Mapbox tileset url'));
15005
+ if (!source.url || !isValid(source.url, sourceUrlPattern)) {
15006
+ errors.push(new ValidationError(`sources[${ i }].url`, source.url, 'Expected a valid Mapbox tileset url'));
15002
15007
  }
15003
15008
  return errors;
15004
15009
  }