Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix api-supported error messages #8971

Merged
merged 3 commits into from
Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/style-spec/validate_mapbox_api_supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ function getSourceErrors(source: Object, i: number): Array<?ValidationError> {
errors.push(...getAllowedKeyErrors(source, sourceKeys, 'source'));

/*
* "sprite" is optional. If present, valid examples:
* "source" is required. Valid examples:
* mapbox://mapbox.abcd1234
* mapbox://penny.abcd1234
* mapbox://mapbox.abcd1234,penny.abcd1234
*/
const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
if (!isValid(source.url, sourceUrlPattern)) {
errors.push(new ValidationError(`sources[${i}]`, source.url, 'Style must reference sources hosted by Mapbox'));
errors.push(new ValidationError(`sources[${i}]`, source.url, 'Source url must be a valid Mapbox tileset url'));
}

return errors;
Expand Down Expand Up @@ -105,7 +105,7 @@ function getRootErrors(style: Object, specKeys: Array<any>): Array<?ValidationEr
errors.push(...allowedKeyErrors);

if (style.version > SUPPORTED_SPEC_VERSION || style.version < SUPPORTED_SPEC_VERSION) {
errors.push(new ValidationError('version', style.version, `style version must be ${SUPPORTED_SPEC_VERSION}`));
errors.push(new ValidationError('version', style.version, `Style version must be ${SUPPORTED_SPEC_VERSION}`));
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"line": 4
},
{
"message": "sources[0]: Style must reference sources hosted by Mapbox",
"message": "sources[0]: Source url must be a valid Mapbox tileset url",
"line": 8
},
{
"message": "sources[1]: Style must reference sources hosted by Mapbox",
"message": "sources[1]: Source url must be a valid Mapbox tileset url",
"line": 12
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"line": 3
},
{
"message": "version: style version must be 8",
"message": "version: Style version must be 8",
"line": 2
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@
"line": 12
},
{
"message": "sources[2]: Style must reference sources hosted by Mapbox",
"message": "sources[2]: Source url must be a valid Mapbox tileset url",
"line": 11
},
{
"message": "source.foo: Unsupported property \"foo\"",
"line": 17
},
{
"message": "sources[3]: Style must reference sources hosted by Mapbox",
"message": "sources[3]: Source url must be a valid Mapbox tileset url",
"line": 16
},
{
Expand Down