+ Cannot render {props.what}
+
+ {JSON.stringify(props.schema, null, 2)}
+
+
+);
+
+function removeTrailingS(str: string) {
+ // Check if the last character is "s" or "S"
+ if (str.endsWith("s") || str.endsWith("S")) {
+ return str.slice(0, -1); // Remove the last character
+ }
+ return str; // Return unchanged if no trailing "s"
+}
+interface SchemaFormProps {
+ title: string;
+ schema: JSONSchema4;
+ path: string[];
+}
+
+export const ModuleForm = (props: { id: string }) => {
+ // TODO: Fetch the synced schema for all the modules at runtime
+ // We use static schema file at build time for now. (Different versions might have different schema at runtime)
+ const schemaQuery = createQuery(() => ({
+ queryKey: [activeURI(), "modules_schema"],
+ queryFn: async () => {
+ const moduleSchema = await import(
+ "../../../api/modules_schemas.json"
+ ).then((m) => m.default as ModuleSchemasType);
+
+ return moduleSchema;
+ },
+ }));
+
+ createEffect(() => {
+ console.log("Schema Query", schemaQuery.data?.[props.id]);
+ });
+
+ const [formStore, { Form, Field }] = createForm();
+ const handleSubmit: SubmitHandler