Skip to content

SourceV2Schema

const SourceV2Schema: z.ZodTypeAny

Defined in: packages/core/src/schemas/map-v2.schema.ts:244

A v2 source: the v1 spec body plus an optional nested runtime:.

Only the geojson source carried live-data keys inline in v1, so it is the one whose spec body is trimmed with SOURCE_RUNTIME_OMIT before the runtime: key is attached. The others carry no live-data keys and are reused as-is. None of these objects are marked open, so a live-data key left in the v1 position (source.refresh) surfaces as an unknown-key warning.

The v1 source schemas carried cross-field guards in a ZodEffects wrapper that baseObject peels off. The guards whose referenced keys survive into the v2 spec are re-applied here so a v2 source is not accepted where its v1 twin is rejected: geojson’s “at least one data source” (now checking url/data/runtime.prefetchedData, since prefetchedData moved under runtime: in v2) and the tile sources’ “url or tiles”.