Skip to content

Commit c12fb64

Browse files
authored
Remove GeoJSON validation (#1052)
1 parent d14a705 commit c12fb64

File tree

4 files changed

+1787
-1494
lines changed

4 files changed

+1787
-1494
lines changed

package.json

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,13 @@
8787
"uglify-js": "^3.0.22",
8888
"unassertify": "^2.0.3"
8989
},
90-
"peerDependencies": {
91-
"mapbox-gl": ">=0.27.0"
92-
},
9390
"dependencies": {
94-
"@mapbox/geojson-area": "^0.2.1",
95-
"@mapbox/geojson-extent": "^0.3.2",
96-
"@mapbox/geojson-normalize": "0.0.1",
97-
"@mapbox/geojsonhint": "3.0.0",
98-
"@mapbox/point-geometry": "0.1.0",
91+
"@mapbox/geojson-area": "^0.2.2",
92+
"@mapbox/geojson-extent": "^1.0.0",
93+
"@mapbox/geojson-normalize": "^0.0.1",
94+
"@mapbox/point-geometry": "^0.1.0",
9995
"hat": "0.0.3",
100-
"lodash.isequal": "^4.2.0",
101-
"xtend": "^4.0.1"
96+
"lodash.isequal": "^4.5.0",
97+
"xtend": "^4.0.2"
10298
}
10399
}

src/api.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import normalize from '@mapbox/geojson-normalize';
33
import hat from 'hat';
44
import featuresAt from './lib/features_at';
55
import stringSetsAreEqual from './lib/string_sets_are_equal';
6-
import geojsonhint from '@mapbox/geojsonhint';
76
import * as Constants from './constants';
87
import StringSet from './lib/string_set';
98

@@ -74,10 +73,6 @@ export default function(ctx, api) {
7473
};
7574

7675
api.add = function (geojson) {
77-
const errors = geojsonhint.hint(geojson, { precisionWarning: false }).filter(e => e.level !== 'message');
78-
if (errors.length) {
79-
throw new Error(errors[0].message);
80-
}
8176
const featureCollection = JSON.parse(JSON.stringify(normalize(geojson)));
8277

8378
const ids = featureCollection.features.map((feature) => {

test/api.test.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,6 @@ test('Draw.add -- GeometryCollection', (t) => {
207207
t.end();
208208
});
209209

210-
test('Draw.add -- Invalid geojson', (t) => {
211-
t.throws(() => {
212-
Draw.add({
213-
type: 'Feature',
214-
properties: {},
215-
geometry: {
216-
type: 'Point',
217-
coordinates: 7
218-
}
219-
});
220-
}, /coordinates/, 'Invalid GeoJSON throws an error');
221-
t.end();
222-
});
223-
224210
test('Draw.add - accept lots of decimal percision', (t) => {
225211
for (let i = 0; i < 30; i++) {
226212
const div = Math.pow(10, i);

0 commit comments

Comments
 (0)