From 89bd54e8e2245581b15d4bacbc8f718e8f4a9061 Mon Sep 17 00:00:00 2001 From: Andrew Calcutt Date: Sun, 21 Jan 2024 17:17:40 -0500 Subject: [PATCH] fix: refactor to use validateStyleMin Signed-off-by: Andrew Calcutt --- src/serve_style.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/serve_style.js b/src/serve_style.js index d497e54..cb0dfcf 100644 --- a/src/serve_style.js +++ b/src/serve_style.js @@ -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];