From c3ea82346991b11bf62207810838f38cc279a590 Mon Sep 17 00:00:00 2001 From: Garrett Date: Fri, 29 Sep 2023 12:00:23 -0700 Subject: [PATCH 1/4] Patch neuroconv schema inconsistency and add requirement entry for objects --- pyflask/manageNeuroconv/manage_neuroconv.py | 2 +- src/renderer/src/stories/JSONSchemaForm.js | 110 ++++++++++-------- src/renderer/src/stories/JSONSchemaInput.js | 3 +- .../pages/guided-mode/data/GuidedMetadata.js | 8 +- .../stories/pages/guided-mode/data/utils.js | 8 ++ 5 files changed, 80 insertions(+), 51 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 1888a0f10..6082703e2 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -88,7 +88,7 @@ def coerce_schema_compliance_recursive(obj, schema): coerce_schema_compliance_recursive(value, prop_schema) elif isinstance(obj, list): for item in obj: - coerce_schema_compliance_recursive(item, schema.get("items", {})) + coerce_schema_compliance_recursive(item, schema.get("items", schema if 'properties' else {})) # NEUROCONV PATCH return obj diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index f8c82241a..3c5d8f50e 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -12,6 +12,9 @@ import { resolveProperties } from "./pages/guided-mode/data/utils"; import { JSONSchemaInput } from "./JSONSchemaInput"; import { InspectorListItem } from "./preview/inspector/InspectorList"; + +const selfRequiredSymbol = Symbol() + const componentCSS = ` * { @@ -153,7 +156,7 @@ export class JSONSchemaForm extends LitElement { }; } - #base = []; + base = []; #nestedForms = {}; tables = {}; #nErrors = 0; @@ -205,7 +208,7 @@ export class JSONSchemaForm extends LitElement { if (props.onStatusChange) this.onStatusChange = props.onStatusChange; - if (props.base) this.#base = props.base; + if (props.base) this.base = props.base; } getTable = (path) => { @@ -242,8 +245,9 @@ export class JSONSchemaForm extends LitElement { } // Track resolved values for the form (data only) - updateData(fullPath, value) { - const path = [...fullPath]; + updateData(localPath, value) { + + const path = [...localPath]; const name = path.pop(); const reducer = (acc, key) => (key in acc ? acc[key] : (acc[key] = {})); // NOTE: Create nested objects if required to set a new path @@ -260,8 +264,8 @@ export class JSONSchemaForm extends LitElement { resultParent[name] = value; resolvedParent[name] = value; } - - if (hasUpdate) this.onUpdate(fullPath, value); // Ensure the value has actually changed + + if (hasUpdate) this.onUpdate(localPath, value); // Ensure the value has actually changed } #addMessage = (name, message, type) => { @@ -271,9 +275,9 @@ export class JSONSchemaForm extends LitElement { container.appendChild(item); }; - #clearMessages = (fullPath, type) => { - if (Array.isArray(fullPath)) fullPath = fullPath.join("-"); // Convert array to string - const container = this.shadowRoot.querySelector(`#${fullPath} .${type}`); + #clearMessages = (localPath, type) => { + if (Array.isArray(localPath)) localPath = localPath.join("-"); // Convert array to string + const container = this.shadowRoot.querySelector(`#${localPath} .${type}`); if (container) { const nChildren = container.children.length; @@ -348,15 +352,15 @@ export class JSONSchemaForm extends LitElement { }; #get = (path, object = this.resolved) => { - // path = path.slice(this.#base.length); // Correct for base path + // path = path.slice(this.base.length); // Correct for base path return path.reduce((acc, curr) => (acc = acc[curr]), object); }; - #checkRequiredAfterChange = async (fullPath) => { - const path = [...fullPath]; + #checkRequiredAfterChange = async (localPath) => { + const path = [...localPath]; const name = path.pop(); const element = this.shadowRoot - .querySelector(`#${fullPath.join("-")}`) + .querySelector(`#${localPath.join("-")}`) .querySelector("jsonschema-input") .getElement(); const isValid = await this.triggerValidation(name, element, path, false); @@ -367,13 +371,13 @@ export class JSONSchemaForm extends LitElement { if (typeof path === "string") path = path.split("."); // NOTE: Still must correct for the base here - if (this.#base.length) { - const base = this.#base.slice(-1)[0]; + if (this.base.length) { + const base = this.base.slice(-1)[0]; const indexOf = path.indexOf(base); if (indexOf !== -1) path = path.slice(indexOf + 1); } - const resolved = path.reduce((acc, curr) => (acc = acc[curr]), schema); + const resolved = this.#get(path, schema) if (resolved["$ref"]) return this.getSchema(resolved["$ref"].split("/").slice(1)); // NOTE: This assumes reference to the root of the schema return resolved; @@ -382,8 +386,8 @@ export class JSONSchemaForm extends LitElement { #renderInteractiveElement = (name, info, required, path = []) => { let isRequired = required[name]; - const fullPath = [...path, name]; - const externalPath = [...this.#base, ...fullPath]; + const localPath = [...path, name]; + const externalPath = [...this.base, ...localPath]; const resolved = this.#get(path, this.resolved); const value = resolved[name]; @@ -392,11 +396,11 @@ export class JSONSchemaForm extends LitElement { if (isConditional && !isRequired) isRequired = required[name] = async () => { - const isRequiredAfterChange = await this.#checkRequiredAfterChange(fullPath); + const isRequiredAfterChange = await this.#checkRequiredAfterChange(localPath); if (isRequiredAfterChange) { return true; } else { - const linkResults = await this.#applyToLinkedProperties(this.#checkRequiredAfterChange, fullPath); // Check links + const linkResults = await this.#applyToLinkedProperties(this.#checkRequiredAfterChange, localPath); // Check links if (linkResults.includes(true)) return true; // Handle updates when no longer required else return false; @@ -405,7 +409,7 @@ export class JSONSchemaForm extends LitElement { const interactiveInput = new JSONSchemaInput({ info, - path: fullPath, + path: localPath, value, form: this, required: isRequired, @@ -425,7 +429,7 @@ export class JSONSchemaForm extends LitElement { return html`
{}; onLoaded = () => {}; - onUpdate = () => {}; + onUpdate = () => {} #deleteExtraneousResults = (results, schema) => { for (let name in results) { @@ -510,7 +517,7 @@ export class JSONSchemaForm extends LitElement { if (this.ignore.includes(key)) return false; if (this.showLevelOverride >= path.length) return isRenderable(key, value); if (required[key]) return isRenderable(key, value); - if (this.#getLink([...this.#base, ...path, key])) return isRenderable(key, value); + if (this.#getLink([...this.base, ...path, key])) return isRenderable(key, value); if (!this.onlyRequired) return isRenderable(key, value); return false; }) @@ -548,7 +555,7 @@ export class JSONSchemaForm extends LitElement { #isLinkResolved = async (pathArr) => { return ( await this.#applyToLinkedProperties((link) => { - const isRequired = this.#isRequired(link.slice((this.#base ?? []).length)); + const isRequired = this.#isRequired(link.slice((this.base ?? []).length)); if (typeof isRequired === "function") return !isRequired.call(this.resolved); else return !isRequired; }, pathArr) @@ -557,8 +564,11 @@ export class JSONSchemaForm extends LitElement { #isRequired = (path) => { if (typeof path === "string") path = path.split("-"); - // path = path.slice(this.#base.length); // Remove base path - return path.reduce((obj, key) => obj && obj[key], this.#requirements); + // path = path.slice(this.base.length); // Remove base path + const res = path.reduce((obj, key) => obj && obj[key], this.#requirements); + + if (typeof res === 'object') res = res[selfRequiredSymbol] + return res }; #getLinkElement = (externalPath) => { @@ -569,17 +579,20 @@ export class JSONSchemaForm extends LitElement { // Assume this is going to return as a Promise—even if the change function isn't returning one triggerValidation = async (name, element, path = [], checkLinks = true) => { + const parent = this.#get(path, this.resolved); + const pathToValidate = [...(this.base ?? []), ...path] + const valid = !this.validateEmptyValues && !(name in parent) ? true - : await this.validateOnChange(name, parent, [...(this.#base ?? []), ...path]); + : await this.validateOnChange(name, parent, pathToValidate); - const fullPath = [...path, name]; // Use basePath to augment the validation - const externalPath = [...this.#base, name]; + const localPath = [...path, name]; // Use basePath to augment the validation + const externalPath = [...this.base, name]; - const isRequired = this.#isRequired(fullPath); + const isRequired = this.#isRequired(localPath); let warnings = Array.isArray(valid) ? valid.filter((info) => info.type === "warning" && (!isRequired || !info.missing)) : []; @@ -596,7 +609,7 @@ export class JSONSchemaForm extends LitElement { // Clear old errors and warnings on linked properties this.#applyToLinkedProperties((path) => { - const internalPath = path.slice((this.#base ?? []).length); + const internalPath = path.slice((this.base ?? []).length); this.#clearMessages(internalPath, "errors"); this.#clearMessages(internalPath, "warnings"); }, externalPath); @@ -610,8 +623,8 @@ export class JSONSchemaForm extends LitElement { } // Clear old errors and warnings - this.#clearMessages(fullPath, "errors"); - this.#clearMessages(fullPath, "warnings"); + this.#clearMessages(localPath, "errors"); + this.#clearMessages(localPath, "warnings"); const isFunction = typeof valid === "function"; const isValid = @@ -628,7 +641,7 @@ export class JSONSchemaForm extends LitElement { this.checkStatus(); // Show aggregated errors and warnings (if any) - warnings.forEach((info) => this.#addMessage(fullPath, info, "warnings")); + warnings.forEach((info) => this.#addMessage(localPath, info, "warnings")); if (isValid && errors.length === 0) { element.classList.remove("invalid"); @@ -638,7 +651,7 @@ export class JSONSchemaForm extends LitElement { await this.#applyToLinkedProperties((path, element) => { element.classList.remove("required", "conditional"); // Links manage their own error and validity states, but only one needs to be valid - }, fullPath); + }, localPath); if (isFunction) valid(); // Run if returned value is a function @@ -656,7 +669,7 @@ export class JSONSchemaForm extends LitElement { [...path, name] ); - errors.forEach((info) => this.#addMessage(fullPath, info, "errors")); + errors.forEach((info) => this.#addMessage(localPath, info, "errors")); // element.title = errors.map((info) => info.message).join("\n"); // Set all errors to show on hover return false; @@ -674,7 +687,7 @@ export class JSONSchemaForm extends LitElement { if (renderable.length === 0) return html`

No properties to render

`; let renderableWithLinks = renderable.reduce((acc, [name, info]) => { - const externalPath = [...this.#base, ...path, name]; + const externalPath = [...this.base, ...path, name]; const link = this.#getLink(externalPath); // Use the base path to find a link if (link) { @@ -735,7 +748,7 @@ export class JSONSchemaForm extends LitElement { // Render linked properties if (entry[isLink]) { const linkedProperties = info.properties.map((path) => { - const pathCopy = [...path].slice((this.#base ?? []).length); + const pathCopy = [...path].slice((this.base ?? []).length); const name = pathCopy.pop(); return this.#renderInteractiveElement(name, schema.properties[name], required, pathCopy); }); @@ -751,7 +764,7 @@ export class JSONSchemaForm extends LitElement { const hasMany = renderable.length > 1; // How many siblings? - const fullPath = [...path, name]; + const localPath = [...path, name]; if (this.mode === "accordion" && hasMany) { const headerName = header(name); @@ -762,8 +775,10 @@ export class JSONSchemaForm extends LitElement { results: { ...results[name] }, globals: this.globals?.[name], + mode: this.mode, + onUpdate: (internalPath, value) => { - const path = [...fullPath, ...internalPath]; + const path = [...localPath, ...internalPath]; this.updateData(path, value); }, @@ -788,13 +803,13 @@ export class JSONSchemaForm extends LitElement { this.checkAllLoaded(); }, renderTable: (...args) => this.renderTable(...args), - base: fullPath, + base: [...this.base, ...localPath], }); const accordion = new Accordion({ sections: { [headerName]: { - subtitle: `${this.#getRenderable(info, required[name], fullPath, true).length} fields`, + subtitle: `${this.#getRenderable(info, required[name], localPath, true).length} fields`, content: this.#nestedForms[name], }, }, @@ -806,7 +821,7 @@ export class JSONSchemaForm extends LitElement { } // Render properties in the sub-schema - const rendered = this.#render(info, results?.[name], required[name], fullPath); + const rendered = this.#render(info, results?.[name], required[name], localPath); return hasMany || path.length > 1 ? html`
@@ -829,7 +844,8 @@ export class JSONSchemaForm extends LitElement { Object.entries(schema.properties).forEach(([key, value]) => { if (value.properties) { let nextAccumulator = acc[key]; - if (!nextAccumulator || typeof nextAccumulator !== "object") nextAccumulator = acc[key] = {}; + const isNotObject = typeof nextAccumulator !== "object" + if (!nextAccumulator || isNotObject) nextAccumulator = acc[key] = {[selfRequiredSymbol]: !!nextAccumulator}; this.#registerRequirements(value, requirements[key], nextAccumulator); } }); diff --git a/src/renderer/src/stories/JSONSchemaInput.js b/src/renderer/src/stories/JSONSchemaInput.js index 5fee127a5..2bb6331df 100644 --- a/src/renderer/src/stories/JSONSchemaInput.js +++ b/src/renderer/src/stories/JSONSchemaInput.js @@ -186,6 +186,7 @@ export class JSONSchemaInput extends LitElement { const fileSystemFormat = isFilesystemSelector(itemSchema.format); if (fileSystemFormat) return createFilesystemSelector(fileSystemFormat); else if (isTable) { + const tableMetadata = { schema: itemSchema, data: this.value, @@ -197,7 +198,7 @@ export class JSONSchemaInput extends LitElement { (this.onValidate ? this.onValidate() : this.form - ? this.form.validateOnChange(key, parent, fullPath, v) + ? this.form.validateOnChange(key, parent, [...this.form.base, ...fullPath], v) : "") ); }, diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js index d3de48412..09b230b2c 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js @@ -110,7 +110,11 @@ export class GuidedMetadataPage extends ManagedPage { results, globals: aggregateGlobalMetadata, - ignore: ["Ophys", "subject_id", "session_id"], + ignore: [ + "Ophys", + "subject_id", + "session_id" + ], conditionalRequirements: [ { @@ -128,7 +132,7 @@ export class GuidedMetadataPage extends ManagedPage { this.#checkAllLoaded(); }, - onUpdate: (...args) => { + onUpdate: () => { this.unsavedUpdates = true; }, diff --git a/src/renderer/src/stories/pages/guided-mode/data/utils.js b/src/renderer/src/stories/pages/guided-mode/data/utils.js index e5ab73f9d..2fa6d5d26 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/data/utils.js @@ -29,10 +29,18 @@ export function resolveProperties(properties = {}, target, globals = {}) { for (let name in properties) { const info = properties[name]; + + // NEUROCONV PATCH: Correct for incorrect array schema + if (info.properties && info.type === 'array') { + info.items = { type: "object", properties: info.properties, required: info.required } + delete info.properties + } + const props = info.properties; if (!(name in target)) { if (props) target[name] = {}; // Regisiter new interfaces in results + if (info.type === 'array') target[name] = [] // Auto-populate arrays // Apply global or default value if empty if (name in globals) target[name] = globals[name]; From 8e5e2344573ce003649aa242fe770b21b96f0732 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 29 Sep 2023 19:03:37 +0000 Subject: [PATCH 2/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyflask/manageNeuroconv/manage_neuroconv.py | 4 ++- src/renderer/src/stories/JSONSchemaForm.js | 27 +++++++++---------- src/renderer/src/stories/JSONSchemaInput.js | 1 - .../pages/guided-mode/data/GuidedMetadata.js | 6 +---- .../stories/pages/guided-mode/data/utils.js | 8 +++--- 5 files changed, 21 insertions(+), 25 deletions(-) diff --git a/pyflask/manageNeuroconv/manage_neuroconv.py b/pyflask/manageNeuroconv/manage_neuroconv.py index 6082703e2..eab144798 100644 --- a/pyflask/manageNeuroconv/manage_neuroconv.py +++ b/pyflask/manageNeuroconv/manage_neuroconv.py @@ -88,7 +88,9 @@ def coerce_schema_compliance_recursive(obj, schema): coerce_schema_compliance_recursive(value, prop_schema) elif isinstance(obj, list): for item in obj: - coerce_schema_compliance_recursive(item, schema.get("items", schema if 'properties' else {})) # NEUROCONV PATCH + coerce_schema_compliance_recursive( + item, schema.get("items", schema if "properties" else {}) + ) # NEUROCONV PATCH return obj diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index 3c5d8f50e..ea248fe7c 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -12,8 +12,7 @@ import { resolveProperties } from "./pages/guided-mode/data/utils"; import { JSONSchemaInput } from "./JSONSchemaInput"; import { InspectorListItem } from "./preview/inspector/InspectorList"; - -const selfRequiredSymbol = Symbol() +const selfRequiredSymbol = Symbol(); const componentCSS = ` @@ -246,7 +245,6 @@ export class JSONSchemaForm extends LitElement { // Track resolved values for the form (data only) updateData(localPath, value) { - const path = [...localPath]; const name = path.pop(); @@ -264,7 +262,7 @@ export class JSONSchemaForm extends LitElement { resultParent[name] = value; resolvedParent[name] = value; } - + if (hasUpdate) this.onUpdate(localPath, value); // Ensure the value has actually changed } @@ -377,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); if (resolved["$ref"]) return this.getSchema(resolved["$ref"].split("/").slice(1)); // NOTE: This assumes reference to the root of the schema return resolved; @@ -465,12 +463,13 @@ export class JSONSchemaForm extends LitElement { // // NOTE: Uncomment to block checking requirements inside optional properties // if (!requirements[name][selfRequiredSymbol] && !resolved[name]) continue; // Do not continue checking requirements if absent and not required - + if (typeof isRequired === "function") isRequired = await isRequired.call(this.resolved); if (isRequired) { let path = parentPath ? `${parentPath}-${name}` : name; - if (typeof isRequired === "object" && !Array.isArray(isRequired)) invalid.push(...(await this.#validateRequirements(resolved[name], isRequired, path))); + if (typeof isRequired === "object" && !Array.isArray(isRequired)) + invalid.push(...(await this.#validateRequirements(resolved[name], isRequired, path))); else if (!resolved[name]) invalid.push(path); } } @@ -481,7 +480,7 @@ export class JSONSchemaForm extends LitElement { // Checks missing required properties and throws an error if any are found onInvalid = () => {}; onLoaded = () => {}; - onUpdate = () => {} + onUpdate = () => {}; #deleteExtraneousResults = (results, schema) => { for (let name in results) { @@ -567,8 +566,8 @@ export class JSONSchemaForm extends LitElement { // path = path.slice(this.base.length); // Remove base path const res = path.reduce((obj, key) => obj && obj[key], this.#requirements); - if (typeof res === 'object') res = res[selfRequiredSymbol] - return res + if (typeof res === "object") res = res[selfRequiredSymbol]; + return res; }; #getLinkElement = (externalPath) => { @@ -579,10 +578,9 @@ export class JSONSchemaForm extends LitElement { // Assume this is going to return as a Promise—even if the change function isn't returning one triggerValidation = async (name, element, path = [], checkLinks = true) => { - const parent = this.#get(path, this.resolved); - const pathToValidate = [...(this.base ?? []), ...path] + const pathToValidate = [...(this.base ?? []), ...path]; const valid = !this.validateEmptyValues && !(name in parent) @@ -844,8 +842,9 @@ export class JSONSchemaForm extends LitElement { Object.entries(schema.properties).forEach(([key, value]) => { if (value.properties) { let nextAccumulator = acc[key]; - const isNotObject = typeof nextAccumulator !== "object" - if (!nextAccumulator || isNotObject) nextAccumulator = acc[key] = {[selfRequiredSymbol]: !!nextAccumulator}; + const isNotObject = typeof nextAccumulator !== "object"; + if (!nextAccumulator || isNotObject) + nextAccumulator = acc[key] = { [selfRequiredSymbol]: !!nextAccumulator }; this.#registerRequirements(value, requirements[key], nextAccumulator); } }); diff --git a/src/renderer/src/stories/JSONSchemaInput.js b/src/renderer/src/stories/JSONSchemaInput.js index 2bb6331df..d125fb257 100644 --- a/src/renderer/src/stories/JSONSchemaInput.js +++ b/src/renderer/src/stories/JSONSchemaInput.js @@ -186,7 +186,6 @@ export class JSONSchemaInput extends LitElement { const fileSystemFormat = isFilesystemSelector(itemSchema.format); if (fileSystemFormat) return createFilesystemSelector(fileSystemFormat); else if (isTable) { - const tableMetadata = { schema: itemSchema, data: this.value, diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js index 09b230b2c..e265e15d5 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedMetadata.js @@ -110,11 +110,7 @@ export class GuidedMetadataPage extends ManagedPage { results, globals: aggregateGlobalMetadata, - ignore: [ - "Ophys", - "subject_id", - "session_id" - ], + ignore: ["Ophys", "subject_id", "session_id"], conditionalRequirements: [ { diff --git a/src/renderer/src/stories/pages/guided-mode/data/utils.js b/src/renderer/src/stories/pages/guided-mode/data/utils.js index 2fa6d5d26..3c3cb6b77 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/data/utils.js @@ -31,16 +31,16 @@ export function resolveProperties(properties = {}, target, globals = {}) { const info = properties[name]; // NEUROCONV PATCH: Correct for incorrect array schema - if (info.properties && info.type === 'array') { - info.items = { type: "object", properties: info.properties, required: info.required } - delete info.properties + if (info.properties && info.type === "array") { + info.items = { type: "object", properties: info.properties, required: info.required }; + delete info.properties; } const props = info.properties; if (!(name in target)) { if (props) target[name] = {}; // Regisiter new interfaces in results - if (info.type === 'array') target[name] = [] // Auto-populate arrays + if (info.type === "array") target[name] = []; // Auto-populate arrays // Apply global or default value if empty if (name in globals) target[name] = globals[name]; From 8dcd0518fe9e6ab6e1b949b41b3df701602cfcd2 Mon Sep 17 00:00:00 2001 From: Garrett Date: Mon, 2 Oct 2023 10:48:30 +0200 Subject: [PATCH 3/4] Fix TwoPhotonSeries autopopulation --- src/renderer/src/stories/pages/guided-mode/data/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/src/stories/pages/guided-mode/data/utils.js b/src/renderer/src/stories/pages/guided-mode/data/utils.js index 3c3cb6b77..17a06aa0e 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/utils.js +++ b/src/renderer/src/stories/pages/guided-mode/data/utils.js @@ -40,7 +40,7 @@ export function resolveProperties(properties = {}, target, globals = {}) { if (!(name in target)) { if (props) target[name] = {}; // Regisiter new interfaces in results - if (info.type === "array") target[name] = []; // Auto-populate arrays + // if (info.type === "array") target[name] = []; // Auto-populate arrays (NOTE: Breaks PyNWB when adding to TwoPhotonSeries field...) // Apply global or default value if empty if (name in globals) target[name] = globals[name]; From 717b3a36b5058e100f2a66520a5d4e4734d34392 Mon Sep 17 00:00:00 2001 From: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> Date: Mon, 2 Oct 2023 09:21:13 -0400 Subject: [PATCH 4/4] fix bad conflict resolution --- src/renderer/src/stories/JSONSchemaForm.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js index a20a4f346..334a03ed6 100644 --- a/src/renderer/src/stories/JSONSchemaForm.js +++ b/src/renderer/src/stories/JSONSchemaForm.js @@ -624,9 +624,9 @@ export class JSONSchemaForm extends LitElement { } // Clear old errors and warnings - this.#clearMessages(fullPath, "errors"); - this.#clearMessages(fullPath, "warnings"); - this.#clearMessages(fullPath, "info"); + this.#clearMessages(localPath, "errors"); + this.#clearMessages(localPath, "warnings"); + this.#clearMessages(localPath, "info"); const isFunction = typeof valid === "function"; const isValid = @@ -643,8 +643,8 @@ export class JSONSchemaForm extends LitElement { this.checkStatus(); // Show aggregated errors and warnings (if any) - warnings.forEach((info) => this.#addMessage(fullPath, info, "warnings")); - info.forEach((info) => this.#addMessage(fullPath, info, "info")); + warnings.forEach((info) => this.#addMessage(localPath, info, "warnings")); + info.forEach((info) => this.#addMessage(localPath, info, "info")); if (isValid && errors.length === 0) { element.classList.remove("invalid");