Home / Function/ validateRssOptions() — astro Function Reference

validateRssOptions() — astro Function Reference

Architecture documentation for the validateRssOptions() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b14ed590_b94e_1c67_3d04_8347d087b61b["validateRssOptions()"]
  6ef7bfdb_4b52_2205_aa0f_e41748222587["index.ts"]
  b14ed590_b94e_1c67_3d04_8347d087b61b -->|defined in| 6ef7bfdb_4b52_2205_aa0f_e41748222587
  39f7c782_b8c0_c38e_4d52_c808fe876c46["getRssString()"]
  39f7c782_b8c0_c38e_4d52_c808fe876c46 -->|calls| b14ed590_b94e_1c67_3d04_8347d087b61b
  style b14ed590_b94e_1c67_3d04_8347d087b61b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro-rss/src/index.ts lines 105–131

async function validateRssOptions(rssOptions: RSSOptions) {
	const parsedResult = await rssOptionsValidator.safeParseAsync(rssOptions);
	if (parsedResult.success) {
		return parsedResult.data;
	}
	const formattedError = new Error(
		[
			`[RSS] Invalid or missing options:`,
			...parsedResult.error.issues.map((zodError) => {
				const path = zodError.path.join('.');
				const message = `${zodError.message} (${path})`;
				const code = zodError.code;

				if (path === 'items' && code === 'invalid_union') {
					return [
						message,
						`The \`items\` property requires at least the \`title\` or \`description\` key. They must be properly typed, as well as \`pubDate\` and \`link\` keys if provided.`,
						`Check your collection's schema, and visit https://docs.astro.build/en/recipes/rss/#generating-items for more info.`,
					].join('\n');
				}

				return message;
			}),
		].join('\n'),
	);
	throw formattedError;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does validateRssOptions() do?
validateRssOptions() is a function in the astro codebase, defined in packages/astro-rss/src/index.ts.
Where is validateRssOptions() defined?
validateRssOptions() is defined in packages/astro-rss/src/index.ts at line 105.
What calls validateRssOptions()?
validateRssOptions() is called by 1 function(s): getRssString.

Analyze Your Own Codebase

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

Try Supermodel Free