Home / Function/ getContentLayerSchema() — astro Function Reference

getContentLayerSchema() — astro Function Reference

Architecture documentation for the getContentLayerSchema() function in types-generator.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b10d9005_fa71_f3ce_7f9d_49b77a03fefd["getContentLayerSchema()"]
  eca81928_a18b_c02e_8e5a_0440befa1a98["types-generator.ts"]
  b10d9005_fa71_f3ce_7f9d_49b77a03fefd -->|defined in| eca81928_a18b_c02e_8e5a_0440befa1a98
  453daca9_4232_0b6c_8607_0e08e829d051["writeContentFiles()"]
  453daca9_4232_0b6c_8607_0e08e829d051 -->|calls| b10d9005_fa71_f3ce_7f9d_49b77a03fefd
  e8e4a435_135c_9f53_dc21_719f629aad4a["generateJSONSchema()"]
  e8e4a435_135c_9f53_dc21_719f629aad4a -->|calls| b10d9005_fa71_f3ce_7f9d_49b77a03fefd
  83cca5af_575c_63ed_977c_458c743a8a6a["getCreateSchemaResult()"]
  b10d9005_fa71_f3ce_7f9d_49b77a03fefd -->|calls| 83cca5af_575c_63ed_977c_458c743a8a6a
  style b10d9005_fa71_f3ce_7f9d_49b77a03fefd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/types-generator.ts lines 388–400

async function getContentLayerSchema<T extends keyof ContentConfig['collections']>(
	collection: ContentConfig['collections'][T],
	collectionKey: T,
): Promise<z.ZodSchema | undefined> {
	if (collection?.type !== CONTENT_LAYER_TYPE || typeof collection.loader === 'function') {
		return;
	}
	if (collection.loader.schema) {
		return collection.loader.schema;
	}
	const result = await getCreateSchemaResult(collection, collectionKey);
	return result?.schema;
}

Subdomains

Frequently Asked Questions

What does getContentLayerSchema() do?
getContentLayerSchema() is a function in the astro codebase, defined in packages/astro/src/content/types-generator.ts.
Where is getContentLayerSchema() defined?
getContentLayerSchema() is defined in packages/astro/src/content/types-generator.ts at line 388.
What does getContentLayerSchema() call?
getContentLayerSchema() calls 1 function(s): getCreateSchemaResult.
What calls getContentLayerSchema()?
getContentLayerSchema() is called by 2 function(s): generateJSONSchema, writeContentFiles.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free