@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 +7 -0
- package/dist/index.cjs +10 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.es.js +10 -5
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/validate/validate_fog.js +0 -6
- package/validate_mapbox_api_supported.js +10 -2
package/package.json
CHANGED
package/validate/validate_fog.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
import ValidationError from '../error/validation_error.js';
|
|
3
3
|
import validate from './validate.js';
|
|
4
4
|
import getType from '../util/get_type.js';
|
|
5
|
-
import {isExpression} from '../expression/index.js';
|
|
6
|
-
import {deepUnbundle} from '../util/unbundle_jsonlint.js';
|
|
7
5
|
|
|
8
6
|
export default function validateFog(options) {
|
|
9
7
|
const fog = options.value;
|
|
@@ -20,10 +18,6 @@ export default function validateFog(options) {
|
|
|
20
18
|
return errors;
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
if (fog.range && !isExpression(deepUnbundle(fog.range)) && fog.range[0] >= fog.range[1]) {
|
|
24
|
-
errors = errors.concat([new ValidationError('fog', fog, 'fog.range[0] can\'t be greater than or equal to fog.range[1]')]);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
21
|
for (const key in fog) {
|
|
28
22
|
const transitionMatch = key.match(/^(.*)-transition$/);
|
|
29
23
|
|
|
@@ -34,6 +34,7 @@ function getAllowedKeyErrors(obj: Object, keys: Array<*>, path: ?string): Array<
|
|
|
34
34
|
return errors;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
const acceptedSourceTypes = new Set(["vector", "raster", "raster-dem"]);
|
|
37
38
|
function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
|
|
38
39
|
const errors = [];
|
|
39
40
|
|
|
@@ -44,6 +45,13 @@ function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
|
|
|
44
45
|
const sourceKeys = ['type', 'url', 'tileSize'];
|
|
45
46
|
errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));
|
|
46
47
|
|
|
48
|
+
/*
|
|
49
|
+
* "type" is required and must be one of "vector", "raster", "raster-dem"
|
|
50
|
+
*/
|
|
51
|
+
if (!acceptedSourceTypes.has(String(source.type))) {
|
|
52
|
+
errors.push(new ValidationError(`sources[${i}].type`, source.type, `Expected one of [${Array.from(acceptedSourceTypes).join(", ")}]`));
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
/*
|
|
48
56
|
* "source" is required. Valid examples:
|
|
49
57
|
* mapbox://mapbox.abcd1234
|
|
@@ -51,8 +59,8 @@ function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
|
|
|
51
59
|
* mapbox://mapbox.abcd1234,penny.abcd1234
|
|
52
60
|
*/
|
|
53
61
|
const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
|
|
54
|
-
if (!isValid(source.url, sourceUrlPattern)) {
|
|
55
|
-
errors.push(new ValidationError(`sources[${i}]`, source.url, '
|
|
62
|
+
if (!source.url || !isValid(source.url, sourceUrlPattern)) {
|
|
63
|
+
errors.push(new ValidationError(`sources[${i}].url`, source.url, 'Expected a valid Mapbox tileset url'));
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
return errors;
|