Group OIDC schemas into an array

This commit is contained in:
Michael B. Gale
2026-04-25 17:07:33 +01:00
parent 2acf81942b
commit 530fcb3bbf
6 changed files with 51 additions and 52 deletions
+15
View File
@@ -0,0 +1,15 @@
import * as json from ".";
export function makeFromSchema<S extends json.Schema>(
includeOptional: boolean,
schema: S,
): json.FromSchema<S> {
const result = {};
for (const [key, validator] of Object.entries(schema)) {
if (!validator.required && !includeOptional) {
continue;
}
result[key] = `value-for-${key}`;
}
return result as json.FromSchema<S>;
}