mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 02:34:21 +00:00
41edbcf67a
Both answers were taken as typed. A value outside the published shape, such as hours that are no text, reached the hours parser and failed the details request. A place outside the shape is now left out of /v1/community, and an element outside it sends the lookup to Overpass.
15 lines
749 B
TypeScript
15 lines
749 B
TypeScript
import { z } from 'zod';
|
|
|
|
/** What the service publishes for a place found elsewhere (Photon, Overpass): the overlay of its own rows. */
|
|
export const trekCommunityValuesSchema = z.object({
|
|
contact: z
|
|
.object({ website: z.string().nullish(), phone: z.string().nullish(), email: z.string().nullish() })
|
|
.nullish(),
|
|
hours: z.object({ osm: z.string().nullish() }).nullish(),
|
|
description: z.object({ text: z.string().nullish() }).nullish(),
|
|
images: z.array(z.object({ url: z.string().optional(), cover: z.boolean().optional() })).nullish(),
|
|
community: z.object({ version: z.number().int().optional(), fields: z.array(z.string()).optional() }).nullish(),
|
|
});
|
|
|
|
export type TrekCommunityValues = z.infer<typeof trekCommunityValuesSchema>;
|