fix: refactor to use validateStyleMin
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
parent
dc746c4a56
commit
89bd54e8e2
1 changed files with 3 additions and 3 deletions
|
|
@ -5,7 +5,7 @@ import fs from 'node:fs';
|
|||
|
||||
import clone from 'clone';
|
||||
import express from 'express';
|
||||
import { validate } from '@maplibre/maplibre-gl-style-spec';
|
||||
import { validateStyleMin } from '@maplibre/maplibre-gl-style-spec';
|
||||
|
||||
import { getPublicUrl } from './utils.js';
|
||||
|
||||
|
|
@ -86,7 +86,8 @@ export const serve_style = {
|
|||
return false;
|
||||
}
|
||||
|
||||
const validationErrors = validate(styleFileData);
|
||||
const styleJSON = JSON.parse(styleFileData);
|
||||
const validationErrors = validateStyleMin(styleJSON);
|
||||
if (validationErrors.length > 0) {
|
||||
console.log(`The file "${params.style}" is not a valid style file:`);
|
||||
for (const err of validationErrors) {
|
||||
|
|
@ -94,7 +95,6 @@ export const serve_style = {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
const styleJSON = JSON.parse(styleFileData);
|
||||
|
||||
for (const name of Object.keys(styleJSON.sources)) {
|
||||
const source = styleJSON.sources[name];
|
||||
|
|
|
|||
Loading…
Reference in a new issue