{"id":47751,"library":"geojson-schema","title":"GeoJSON Schema","description":"Generates standalone JSON Schema documents for GeoJSON object types (Feature, Point, Polygon, etc.) as defined by RFC 7946. Current stable version is 1.0.5, released infrequently. Each schema is self-contained (no $ref dependencies), allowing consumers to fetch only what they need. Key differentiator: provides complete, non-referenced schemas ideal for offline or selective validation. Cannot validate linear ring closure or right-hand rule, requiring custom logic. Used for validating GeoJSON structures in any JSON Schema compliant validator.","status":"active","version":"1.0.5","language":"javascript","source_language":"en","source_url":"git://github.com/geojson/schema","tags":["javascript","geojson","schema"],"install":[{"cmd":"npm install geojson-schema","lang":"bash","label":"npm"},{"cmd":"yarn add geojson-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add geojson-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package provides raw JSON files. Use require or fetch. No ESM exports.","wrong":"import { PointSchema } from 'geojson-schema'","symbol":"PointSchema","correct":"const PointSchema = require('geojson-schema/Point.json')"},{"note":"Use CommonJS require. ESM import with assert { type: 'json' } may work in some bundlers.","wrong":"import FeatureSchema from 'geojson-schema/Feature.json'","symbol":"FeatureSchema","correct":"const FeatureSchema = require('geojson-schema/Feature.json')"},{"note":"Main entry point includes all types via $ref, but individual files are preferred.","wrong":"const GeoJSONSchema = require('geojson-schema')","symbol":"GeoJSONSchema","correct":"const GeoJSONSchema = require('geojson-schema/GeoJSON.json')"}],"quickstart":{"code":"const Ajv = require('ajv');\nconst ajv = new Ajv();\nconst PointSchema = require('geojson-schema/Point.json');\nconst validate = ajv.compile(PointSchema);\n\nconst validPoint = {\n  \"type\": \"Point\",\n  \"coordinates\": [102.0, 0.5]\n};\n\nconst invalidPoint = {\n  \"type\": \"Point\",\n  \"coordinates\": [102.0]\n};\n\nconsole.log(validate(validPoint) ? 'Valid' : 'Invalid'); // Valid\nconsole.log(validate(invalidPoint) ? 'Valid' : 'Invalid'); // Invalid\nconsole.log(JSON.stringify(validate.errors));","lang":"javascript","description":"Validates a GeoJSON Point using AJV with the standalone Point schema from geojson-schema."},"warnings":[{"fix":"Implement custom validation for closed rings and right-hand rule as per RFC 7946.","message":"Cannot validate linear ring closure or right-hand rule.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use individual schemas directly; do not rely on $ref to other schemas.","message":"Schemas are self-contained; avoid combining them if you need cross-references.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use CommonJS require or configure your bundler to handle JSON imports.","message":"Package exports raw JSON files, not JavaScript modules. ESM import may require assertions or bundler configuration.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.5':25 '7946':20 'allow':37 'cannot':59 'closur':63 'complet':48 'compliant':81 'consum':38 'contain':33 'current':21 'custom':70 'defin':17 'depend':36 'differenti':46 'document':7 'etc':15 'featur':12 'fetch':40 'generat':3 'geojson':1,9,75,84 'hand':67 'ideal':53 'infrequ':27 'javascript':83 'json':5,79 'key':45 'linear':61 'logic':71 'need':44 'non':50 'non-referenc':49 'object':10 'offlin':55 'point':13 'polygon':14 'provid':47 'ref':35 'referenc':51 'releas':26 'requir':69 'rfc':19 'right':66 'right-hand':65 'ring':62 'rule':68 'schema':2,6,29,52,80,85 'select':57 'self':32 'self-contain':31 'stabl':22 'standalon':4 'structur':76 'type':11 'use':72 'valid':58,60,74,82 'version':23","created_at":"2026-06-07T16:53:07.298324+00:00","updated_at":"2026-06-07T16:53:07.298324+00:00","problems":[{"fix":"Use require('geojson-schema/Point.json') with the specific schema file.","cause":"Importing the package as a module without specifying a JSON file path.","error":"Cannot find module 'geojson-schema'"},{"fix":"Use require() with the .json extension, or if using ESM, use createRequire or import assertion.","cause":"Using ESM imports with Node.js and assuming the package exports JavaScript modules.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/geojson/schema#readme","github":"git://github.com/geojson/schema","docs":null,"changelog":null,"pypi":null,"npm":"geojson-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}