diff --git a/schemas/json/dandi/upload.json b/schemas/json/dandi/upload.json index 40f130e47..a7cfbb62a 100644 --- a/schemas/json/dandi/upload.json +++ b/schemas/json/dandi/upload.json @@ -6,6 +6,7 @@ }, "cleanup": { "type": "boolean", + "title": "Delete Local Files After Upload", "default": false } }, diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index 7a51344d0..195d6cbfb 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -349,9 +349,9 @@ export class JSONSchemaForm extends LitElement { return true; }; - #get = (path, object = this.resolved) => { + #get = (path, object = this.resolved, omitted = []) => { // path = path.slice(this.base.length); // Correct for base path - return path.reduce((acc, curr) => (acc = acc[curr]), object); + return path.reduce((acc, curr) => (acc = acc[curr] ?? acc?.[omitted.find((str) => acc[str])]?.[curr]), object); }; #checkRequiredAfterChange = async (localPath) => { @@ -375,7 +375,7 @@ export class JSONSchemaForm extends LitElement { if (indexOf !== -1) path = path.slice(indexOf + 1); } - const resolved = this.#get(path, schema); + const resolved = this.#get(path, schema, ["properties"]); if (resolved["$ref"]) return this.getSchema(resolved["$ref"].split("/").slice(1)); // NOTE: This assumes reference to the root of the schema return resolved; @@ -432,7 +432,7 @@ export class JSONSchemaForm extends LitElement { ? "conditional" : ""}" > - + ${interactiveInput}
@@ -619,7 +619,13 @@ export class JSONSchemaForm extends LitElement { } else { // For non-links, throw a basic requirement error if the property is required if (!errors.length && isRequired && !parent[name]) { - errors.push({ message: `${name} is a required property.`, type: "error", missing: true }); // Throw at least a basic error if the property is required + const schema = this.getSchema(localPath); + console.log(schema); + errors.push({ + message: `${schema.title ?? header(name)} is a required property.`, + type: "error", + missing: true, + }); // Throw at least a basic error if the property is required } }