normalizeLayer
normalizeLayer(
layer):LayerModel
Defined in: packages/core/src/model/normalize.ts:162
Normalize one layer, including any source declared inline on it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
layer | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<object & object, ZodTypeAny, "passthrough"> | objectOutputType<{ id: ZodString; layout: ZodOptional<ZodObject<{ }, "passthrough", ZodTypeAny, objectOutputType<{ }, ZodTypeAny, "passthrough">, objectInputType<{ }, ZodTypeAny, "passthrough">>>; metadata: ZodOptional<ZodRecord<ZodString, ZodAny>>; paint: ZodOptional<ZodObject<{ background-color: ZodOptional<ZodUnion<[ZodEffects<ZodString, string, string>, ZodType<…[], ZodTypeDef, …[]>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…[], ZodTypeDef, …[]>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…[], ZodTypeDef, …[]>]>>; }, "passthrough", ZodTypeAny, objectOutputType<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, ZodTypeAny, "passthrough">, objectInputType<{ background-color: ZodOptional<ZodUnion<[ZodEffects<…, …, …>, ZodType<…, …, …>]>>; background-opacity: ZodOptional<ZodUnion<[ZodNumber, ZodType<…, …, …>]>>; background-pattern: ZodOptional<ZodUnion<[ZodString, ZodType<…, …, …>]>>; }, ZodTypeAny, "passthrough">>>; type: ZodLiteral<"background">; }, ZodTypeAny, "passthrough"> |
Returns
Section titled “Returns”Remarks
Section titled “Remarks”A layer may carry its source inline rather than by name, and that object
needs the same split as a named one — otherwise its live-data keys ride into
layer.spec, which is the half defined as compiling to style.json. That is
the leak the 0.4.0 named-source scrub existed to close, and it is not limited
to live-data documents: the geojson schema materializes fetchStrategy by
default on every source, so the emitted style would carry an unknown property
MapLibre’s validator rejects for essentially any document.
A string source is a named reference and stays as-is.