@ipsdi/neris-schemas
v0.0.1
Published
JSON Schema definitions for validating NERIS (National Emergency Response Information System) data
Maintainers
Readme
NERIS JSON Schemas
JSON Schema definitions for validating data against the NERIS (National Emergency Response Information System) specification.
Installation
npm install @ipsdi/neris-schemasUsage
Load schemas programmatically
import { getSchema, getDepartmentPayloadSchema } from "@ipsdi/neris-schemas";
// Get any schema by name
const schema = getSchema("DepartmentPayload");
// Or use convenience functions
const departmentSchema = getDepartmentPayloadSchema();Validate with Ajv
import Ajv from "ajv";
import { getDepartmentPayloadSchema } from "@ipsdi/neris-schemas";
const ajv = new Ajv();
const validate = ajv.compile(getDepartmentPayloadSchema());
const department = {
fd_id: "12345",
name: "Example Fire Department",
// ...
};
if (validate(department)) {
console.log("Valid NERIS department data");
} else {
console.error(validate.errors);
}TypeScript types
import type { DepartmentPayload, StationPayload } from "@ipsdi/neris-schemas/types";Direct schema import
import departmentSchema from "@ipsdi/neris-schemas/v1/DepartmentPayload.json";Available Schemas
635 schemas are generated from the NERIS OpenAPI specification, including:
DepartmentPayload,CreateDepartmentPayload,DepartmentResponseStationPayload,CreateStationPayload,StationResponseIncidentPayload,CreateIncidentPayload,IncidentResponseFirePayload,MedicalPayload,DispatchPayload- Value types:
TypeDeptValue,TypeEntityValue,TypeUnitValue, etc.
Development
# Install dependencies
npm install
# Generate schemas from NERIS OpenAPI spec
npm run generate
# Generate TypeScript types
npm run generate:types
# Build package
npm run build
# Lint and typecheck
npm run lintLicense
MIT
