{"_id":"@damnthonyy/json-schema-validate","_rev":"3-621a8a08ba1c952cd4df7464e08a0c41","name":"@damnthonyy/json-schema-validate","dist-tags":{"latest":"1.1.3"},"versions":{"1.1.1":{"name":"@damnthonyy/json-schema-validate","version":"1.1.1","keywords":["json-schema","openapi","spectral","validation","oas2","oas3","oas3.1","typescript"],"author":{"name":"Antoine Mahassadi","email":"dmantoinepro@gmail.com"},"license":"MIT","_id":"@damnthonyy/json-schema-validate@1.1.1","maintainers":[{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"}],"homepage":"https://github.com/damnthonyy/json-schema-validate#readme","bugs":{"url":"https://github.com/damnthonyy/json-schema-validate/issues"},"dist":{"shasum":"7594aed2fdc9b85d742ccf3f6393483a40321c60","tarball":"https://registry.npmjs.org/@damnthonyy/json-schema-validate/-/json-schema-validate-1.1.1.tgz","fileCount":34,"integrity":"sha512-YK/kgGZswVqWcf293+FT0XL7+z/BEU1YkT1QTSoZbJqHdX16s79r3Z1BbyzC6qmCa2hOvCqXadethJzm9oVaHw==","signatures":[{"sig":"MEQCIHIi/SGmsF+NXA5bDJ3fVFHsKEzI/0NXyhFF63MczZC5AiAaRuiKit/Ncx52wuVGn8X1+g2SPrMv85esNvQ2U9zeoA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30101},"main":"dist/index.export.js","types":"dist/index.export.d.ts","exports":{".":{"types":"./dist/index.export.d.ts","import":"./dist/index.export.js","require":"./dist/index.export.js"},"./validator":{"types":"./dist/validators/openapi-schema.validator.d.ts","import":"./dist/validators/openapi-schema.validator.js","require":"./dist/validators/openapi-schema.validator.js"}},"gitHead":"e3b53badf79ad2036d4ae61d9fa07fef2c2447d7","scripts":{"dev":"ts-node index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && npm run copy-assets","start":"node dist/index.js","test:ui":"vitest --ui","test:run":"vitest run","copy-assets":"mkdir -p dist/rules && cp rules/*.yaml dist/rules/","prepublishOnly":"npm run build && npm run test:run"},"_npmUser":{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"},"repository":{"url":"git+https://github.com/damnthonyy/json-schema-validate.git","type":"git"},"_npmVersion":"10.8.2","description":"JSON Schema and OpenAPI validator using Spectral and swagger-parser","directories":{},"_nodeVersion":"18.20.8","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@stoplight/spectral-core":"^1.18.3","@apidevtools/swagger-parser":"^10.1.0","@stoplight/spectral-formats":"^1.5.0","@stoplight/spectral-parsers":"^1.0.3","@stoplight/spectral-rulesets":"^1.16.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.1.0","express":"^4.18.2","ts-node":"^10.9.2","@vitest/ui":"^1.1.0","typescript":"^5.3.3","@types/node":"^20.10.6","@types/lodash":"^4.14.201","swagger-jsdoc":"^6.2.8","@types/express":"^4.17.21","@types/js-yaml":"^4.0.9","swagger-ui-express":"^5.0.0","@types/swagger-ui-express":"^4.1.6"},"_npmOperationalInternal":{"tmp":"tmp/json-schema-validate_1.1.1_1780662906097_0.4289202020761935","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@damnthonyy/json-schema-validate","version":"1.1.2","keywords":["json-schema","openapi","spectral","validation","oas2","oas3","oas3.1","typescript"],"author":{"name":"Antoine Mahassadi","email":"dmantoinepro@gmail.com"},"license":"MIT","_id":"@damnthonyy/json-schema-validate@1.1.2","maintainers":[{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"}],"homepage":"https://github.com/damnthonyy/json-schema-validate#readme","bugs":{"url":"https://github.com/damnthonyy/json-schema-validate/issues"},"dist":{"shasum":"2266ad7a54dfd680ee0066840df39b49f246b3e0","tarball":"https://registry.npmjs.org/@damnthonyy/json-schema-validate/-/json-schema-validate-1.1.2.tgz","fileCount":34,"integrity":"sha512-nPkWZXJ+HBe0mTy4ysM4rO/MVG8BmAgfi9YT33yA30ModTeoj4/nbP1Sg7A7macE4erzxxJbYZMSaYjMnScV0Q==","signatures":[{"sig":"MEUCIBPimcGdGxntJY8yoiB+d+77A7BSZXPOeDvkjhiRM00vAiEAzy0YbeZk7tRg5fkcwXy9GLFM6vChu9hYkpcZF7gKKrE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30173},"main":"dist/index.export.js","types":"dist/index.export.d.ts","exports":{".":{"types":"./dist/index.export.d.ts","import":"./dist/index.export.js","require":"./dist/index.export.js"},"./validator":{"types":"./dist/validators/openapi-schema.validator.d.ts","import":"./dist/validators/openapi-schema.validator.js","require":"./dist/validators/openapi-schema.validator.js"}},"gitHead":"20b717f92b1910a5a7f83c6c4602b85ca41fa944","scripts":{"dev":"ts-node index.ts","test":"vitest","build":"tsc -p tsconfig.build.json && npm run copy-assets","start":"node dist/index.js","test:ui":"vitest --ui","test:run":"vitest run","copy-assets":"mkdir -p dist/rules && cp rules/*.yaml dist/rules/","prepublishOnly":"npm run build && npm run test:run"},"_npmUser":{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"},"repository":{"url":"git+https://github.com/damnthonyy/json-schema-validate.git","type":"git"},"_npmVersion":"10.8.2","description":"JSON Schema and OpenAPI validator using Spectral and swagger-parser","directories":{},"_nodeVersion":"18.20.8","dependencies":{"lodash":"^4.17.21","js-yaml":"^4.1.0","@stoplight/spectral-core":"^1.18.3","@apidevtools/swagger-parser":"^10.1.0","@stoplight/spectral-formats":"^1.5.0","@stoplight/spectral-parsers":"^1.0.3","@stoplight/spectral-rulesets":"^1.16.0"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.1.0","express":"^4.18.2","ts-node":"^10.9.2","@vitest/ui":"^1.1.0","typescript":"^5.3.3","@types/node":"^20.10.6","@types/lodash":"^4.14.201","swagger-jsdoc":"^6.2.8","@types/express":"^4.17.21","@types/js-yaml":"^4.0.9","swagger-ui-express":"^5.0.0","@types/swagger-ui-express":"^4.1.6"},"_npmOperationalInternal":{"tmp":"tmp/json-schema-validate_1.1.2_1780664007481_0.9029206996314292","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@damnthonyy/json-schema-validate","version":"1.1.3","description":"JSON Schema and OpenAPI validator using Spectral and swagger-parser","main":"dist/index.export.js","exports":{".":{"import":"./dist/index.export.js","require":"./dist/index.export.js","types":"./dist/index.export.d.ts"},"./validator":{"import":"./dist/validators/openapi-schema.validator.js","require":"./dist/validators/openapi-schema.validator.js","types":"./dist/validators/openapi-schema.validator.d.ts"}},"types":"dist/index.export.d.ts","repository":{"type":"git","url":"git+https://github.com/damnthonyy/json-schema-validate.git"},"bugs":{"url":"https://github.com/damnthonyy/json-schema-validate/issues"},"homepage":"https://github.com/damnthonyy/json-schema-validate#readme","scripts":{"dev":"ts-node index.ts","build":"tsc -p tsconfig.build.json && npm run copy-assets","start":"node dist/index.js","copy-assets":"mkdir -p dist/rules && cp rules/*.yaml dist/rules/","test":"vitest","test:ui":"vitest --ui","test:run":"vitest run","prepublishOnly":"npm run build && npm run test:run"},"keywords":["json-schema","openapi","spectral","validation","oas2","oas3","oas3.1","typescript"],"author":{"name":"Antoine Mahassadi","email":"dmantoinepro@gmail.com"},"license":"MIT","dependencies":{"@apidevtools/swagger-parser":"^10.1.0","@stoplight/spectral-core":"^1.18.3","@stoplight/spectral-formats":"^1.5.0","@stoplight/spectral-rulesets":"^1.16.0","@stoplight/spectral-parsers":"^1.0.3","js-yaml":"^4.1.0","lodash":"^4.17.21"},"devDependencies":{"typescript":"^5.3.3","ts-node":"^10.9.2","@types/express":"^4.17.21","@types/node":"^20.10.6","@types/lodash":"^4.14.201","@types/js-yaml":"^4.0.9","@types/swagger-ui-express":"^4.1.6","express":"^4.18.2","swagger-ui-express":"^5.0.0","swagger-jsdoc":"^6.2.8","vitest":"^1.1.0","@vitest/ui":"^1.1.0"},"_id":"@damnthonyy/json-schema-validate@1.1.3","gitHead":"b4af33d0b52193ed2a79995227906b2c069c3abc","_nodeVersion":"18.20.8","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Dk9akVZRG+rKuHxAmX8axudZLYKZ9Zmfo7/GkaVqcqlKh+qsnEg0FZbuCUYxosPS8uHMZrx/DqXh3CToW4RkVA==","shasum":"6b62d88da7de3cbac479212843a6775b41d140c4","tarball":"https://registry.npmjs.org/@damnthonyy/json-schema-validate/-/json-schema-validate-1.1.3.tgz","fileCount":34,"unpackedSize":28058,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDMml8WNI9YhPfdzUHsZIwl078du9SVbwWrXqyhzucSkAIhAPKVSYOXCidC9RNWM2S+Mtu0FHq3E/li90UfukbsLANy"}]},"_npmUser":{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"},"directories":{},"maintainers":[{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/json-schema-validate_1.1.3_1780667794033_0.6427592175784493"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-05T12:35:05.930Z","modified":"2026-06-05T13:56:34.330Z","1.1.1":"2026-06-05T12:35:06.243Z","1.1.2":"2026-06-05T12:53:27.606Z","1.1.3":"2026-06-05T13:56:34.196Z"},"bugs":{"url":"https://github.com/damnthonyy/json-schema-validate/issues"},"author":{"name":"Antoine Mahassadi","email":"dmantoinepro@gmail.com"},"license":"MIT","homepage":"https://github.com/damnthonyy/json-schema-validate#readme","keywords":["json-schema","openapi","spectral","validation","oas2","oas3","oas3.1","typescript"],"repository":{"type":"git","url":"git+https://github.com/damnthonyy/json-schema-validate.git"},"description":"JSON Schema and OpenAPI validator using Spectral and swagger-parser","maintainers":[{"name":"damnthonyy","email":"mahassadijoseph@gmail.com"}],"readme":"# json-schema-validate\n\n[![CI](https://github.com/damnthonyy/json-schema-validate/workflows/CI/badge.svg)](https://github.com/damnthonyy/json-schema-validate/actions?query=workflow%3ACI)\n[![npm version](https://img.shields.io/npm/v/@damnthonyy/json-schema-validate)](https://www.npmjs.com/package/@damnthonyy/json-schema-validate)\n<!-- [![npm downloads](https://img.shields.io/npm/dm/@damnthonyy/json-schema-validate)](https://www.npmjs.com/package/@damnthonyy/json-schema-validate) -->\n<!-- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -->\n\nA lightweight OpenAPI and JSON Schema validator that combines **swagger-parser** and **Spectral**.\n\n## Why?\n\n**Problem:** Neither tool alone is complete:\n- **swagger-parser** detects circular references but doesn't flag them as violations\n- **Spectral** doesn't handle circular references correctly\n\n**Solution:** This package merges both:\n1. **swagger-parser** → Structural validation (broken refs, format errors, circular detection)\n2. **Spectral** → Quality rules (OAS compliance, custom rules)\n\n## Installation\n\n```bash\nnpm install @damnthonyy/json-schema-validate\n```\n\n## Usage\n\n```typescript\nimport { validateSchema } from '@damnthonyy/json-schema-validate';\n\nconst spec = {\n  openapi: '3.0.0',\n  info: { title: 'My API', version: '1.0.0' },\n  paths: {\n    '/users': {\n      get: {\n        responses: {\n          '200': {\n            description: 'List of users',\n            content: {\n              'application/json': {\n                schema: { $ref: '#/components/schemas/User' }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  components: {\n    schemas: {\n      User: {\n        type: 'object',\n        properties: {\n          id: { type: 'integer' },\n          name: { type: 'string' }\n        }\n      }\n    }\n  }\n};\n\nconst result = await validateSchema(spec);\n\nif (result.valid) {\n  console.log('✅ Spec is valid');\n} else {\n  result.issues.forEach(issue => {\n    console.log(`[${issue.severity}] ${issue.source}: ${issue.message}`);\n    console.log(`  at: ${issue.path}`);\n  });\n}\n```\n\n## Response\n\n```typescript\ninterface ValidationResult {\n  valid: boolean;\n  issues: ValidationIssue[];\n}\n\ninterface ValidationIssue {\n  path: string;                              // JSON Pointer path\n  message: string;                           // Error message\n  severity: 'error' | 'warning' | 'info';   // Severity level\n  source: 'swagger-parser' | 'spectral';    // Which validator found it\n}\n```\n\n## What Gets Validated\n\n### Structural Issues (swagger-parser)\n- ✅ Broken `$ref` references\n- ✅ Circular references (Pet → Owner → Pet)\n- ✅ Invalid OpenAPI format\n- ✅ Missing required fields\n\n### Quality Issues (Spectral)\n- ✅ Empty descriptions\n- ✅ Missing types in schemas\n- ✅ OAS compliance rules\n- ✅ Custom rules (extensible)\n\n## Customizing Rules\n\nEdit `rules/spectral.ruleset.yaml`:\n\n```yaml\nextends:\n  - spectral:oas\n\nrules:\n  no-empty-description:\n    description: Descriptions must not be empty\n    given: \"$..description\"\n    severity: warn\n    then:\n      function: pattern\n      functionOptions:\n        match: \".+\"\n```\n\n## Testing\n\n```bash\nnpm run test:run\n```\n\n## Contributing\n\nFound a bug or want to suggest an improvement? [Open an issue](https://github.com/damnthonyy/json-schema-validate/issues)\n\n## License\n\nMIT","readmeFilename":"README.md"}