* Validate that all required params have values (either from preset or defaults). * Throws if any required param is missing a value.
(
allParams: Array<{
name: string;
defaultValue: string;
type: string;
ephemeral: boolean;
required: boolean;
}>,
coveredByPreset: Set<string>
)
| 846 | * Throws if any required param is missing a value. |
| 847 | */ |
| 848 | validateRequiredParams( |
| 849 | allParams: Array<{ |
| 850 | name: string; |
| 851 | defaultValue: string; |
| 852 | type: string; |
| 853 | ephemeral: boolean; |
| 854 | required: boolean; |
| 855 | }>, |
| 856 | coveredByPreset: Set<string> |
| 857 | ): void { |
| 858 | const missing: string[] = []; |
| 859 | |
| 860 | for (const p of allParams) { |
| 861 | if (p.ephemeral) continue; |
| 862 | if (p.required && !p.defaultValue && !coveredByPreset.has(p.name)) { |
| 863 | missing.push(p.name); |
| 864 | } |
| 865 | } |
| 866 | |
| 867 | if (missing.length > 0) { |
| 868 | throw new Error( |
| 869 | `Required template parameters missing values: ${missing.join(", ")}. ` + |
| 870 | `Select a preset that provides these values or contact your template admin.` |
| 871 | ); |
| 872 | } |
| 873 | } |
| 874 | |
| 875 | /** |
| 876 | * List available Coder templates. |
no test coverage detected