NERIS JSON Schemas
JSON Schema definitions for validating data against the NERIS (National Emergency Response Information System) specification.
Installation
npm install @ipsdi/neris-schemas
Usage
Load schemas programmatically
import { getSchema, getDepartmentPayloadSchema } from "@ipsdi/neris-schemas";
const schema = getSchema("DepartmentPayload");
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, DepartmentResponse
StationPayload, CreateStationPayload, StationResponse
IncidentPayload, CreateIncidentPayload, IncidentResponse
FirePayload, MedicalPayload, DispatchPayload
- Value types:
TypeDeptValue, TypeEntityValue, TypeUnitValue, etc.
Development
npm install
npm run generate
npm run generate:types
npm run build
npm run lint
License
MIT