schemas
Zod schemas for the city data file formats. Validate generated files with `safeParse`.
api.schemas. 6 members.
| Member | Returns | Summary |
|---|---|---|
DemandPointSchema | z.ZodObject<object, z.core.$strip> | Zod schema for one demand point in demand_data.json. |
PopSchema | z.ZodObject<object, z.core.$strip> | Zod schema for one pop (commuter group) in demand_data.json. |
DemandDataSchema | z.ZodObject<object, z.core.$strip> | Zod schema for a whole demand_data.json: { points: DemandPoint[], pops: Pop[] }. |
RoadPropertiesSchema | z.ZodObject<object, z.core.$strip> | Zod schema for the properties of one road feature. |
RoadsGeojsonSchema | z.ZodObject<object, z.core.$strip> | Zod schema for roads.geojson: a FeatureCollection of LineString features with [lng, lat] coordinates and RoadPropertiesSchema properties. |
RunwaysTaxiwaysGeojsonSchema | z.ZodObject<object, z.core.$strip> | Zod schema for runways_taxiways.geojson: a FeatureCollection of Polygon features with [lng, lat] rings and optional free-form properties. |
DemandPointSchema#
api.schemas.DemandPointSchema: z.ZodObject<{…}, z.core.$strip>Zod schema for one demand point in demand_data.json.
Fields: id string, location [number, number] as [lng, lat], jobs integer >= 0, residents integer >= 0, popIds string array.
const result = api.schemas.DemandPointSchema.safeParse({ id: 'p1', location: [-73.98, 40.75], jobs: 120, residents: 40, popIds: [] });
console.log(result.success ? 'valid demand point' : result.error.issues);PopSchema#
api.schemas.PopSchema: z.ZodObject<{…}, z.core.$strip>Zod schema for one pop (commuter group) in demand_data.json.
Fields: id string, size integer > 0, residenceId string, jobId string, drivingSeconds number >= 0 (s), drivingDistance number >= 0 (m), optional drivingPath as [lng, lat] pairs.
DemandDataSchema#
api.schemas.DemandDataSchema: z.ZodObject<{…}, z.core.$strip>Zod schema for a whole demand_data.json: { points: DemandPoint[], pops: Pop[] }.
RoadPropertiesSchema#
api.schemas.RoadPropertiesSchema: z.ZodObject<{…}, z.core.$strip>Zod schema for the properties of one road feature.
Fields: roadClass one of 'highway', 'major', 'medium', 'minor'; structure one of 'normal', 'tunnel', 'bridge'; name string.
RoadsGeojsonSchema#
api.schemas.RoadsGeojsonSchema: z.ZodObject<{…}, z.core.$strip>Zod schema for roads.geojson: a FeatureCollection of LineString features with [lng, lat] coordinates and RoadPropertiesSchema properties.
RunwaysTaxiwaysGeojsonSchema#
api.schemas.RunwaysTaxiwaysGeojsonSchema: z.ZodObject<{…}, z.core.$strip>Zod schema for runways_taxiways.geojson: a FeatureCollection of Polygon features with [lng, lat] rings and optional free-form properties.