Skip to content

Use the browsable schema picker in the layout creator#956

Draft
JeroenDeDauw wants to merge 9 commits into
masterfrom
feature/layout-creator-schema-picker
Draft

Use the browsable schema picker in the layout creator#956
JeroenDeDauw wants to merge 9 commits into
masterfrom
feature/layout-creator-schema-picker

Conversation

@JeroenDeDauw

@JeroenDeDauw JeroenDeDauw commented Jun 27, 2026

Copy link
Copy Markdown
Member

Fixes #955

Stacked on #953 (the SchemaPicker browsable picker) — this PR targets that branch, so its diff is just the layout-creator change. Merge #953 first; GitHub retargets this to master afterwards.

The layout creator selected the Layout's Schema with a plain CdxSelect fed by a separate getSchemaNames( '' ) call (names only, no descriptions, no type-to-filter). Replace it with the shared SchemaPicker component, which browses the full schema list, filters as you type, shows schema descriptions, and reuses the cached all-schemas summary load — matching the subject creator and relation-property pickers.

onSchemaSelected now receives the picked schema name (SchemaPicker only commits an exact existing schema), and the dead getSchemaNames load and its now-orphaned placeholder message are removed.

LayoutCreator has no unit test to extend, so correctness here rests on SchemaPicker's own coverage plus a browser check of the Layout creation dialog (open Special:Layouts → Create Layout). make tsci is green (1060 tests, build + lint).

Directed by @JeroenDeDauw, who picked this up from the #953 review.
Context: the NeoWiki codebase and a frontend inventory of every schema-selection site.
Written by Claude Code, Opus 4.8

JeroenDeDauw and others added 9 commits June 27, 2026 20:26
Add a SchemaSummary type and getSchemaSummaries( offset, limit ) to the SchemaLookup
port, with REST (GET /neowiki/v0/schemas) and in-memory implementations — reusing the
endpoint the Schemas page already uses, no new backend. A cached, paginated
getAllSchemaSummaries() store action loads every schema once (cleared on save) for the
schema picker to filter client-side. SchemasPage reuses the shared SchemaSummary type.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Rebuild SchemaLookup on CdxCombobox so the field opens the full schema list on click
(empty or filled) and filters as you type, with descriptions shown throughout. Only an
exact existing schema is committed; unmatched text reverts to the committed value on
blur, so the field never holds an invalid value. Reword the now-shared placeholder to
"Select a schema" under a neutral neowiki-schema-lookup-placeholder key, stretch the
field to full width, and register CdxCombobox.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Clearing the relation type now updates the model instead of silently keeping the
previous value; the property name is used only as the on-create default. The
target-schema required error shows only after the field has been touched (visited and
left empty) rather than immediately on a newly added relation property.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follow-ups from the #953 review:

- Page getAllSchemaSummaries by request offset instead of loaded count.
  The summaries endpoint counts every Schema page in totalRows but omits
  ones it cannot load (restricted/malformed), so advancing the offset by
  the loaded count re-requested earlier names and duplicated entries in
  the cached picker list.
- Handle a failed schema load in SchemaLookup's onMounted instead of
  leaving an unhandled rejection and a silently empty picker.
- Commit the canonical schema name from the picker rather than the raw
  combobox text, so input with surrounding whitespace cannot store a
  target schema that does not resolve.
- Simplify the picker's menu state to a computed over a query ref,
  removing the imperative showAllSchemas/toMenuItems bookkeeping, and
  drop the now-unused searchAndFetchMissingSchemas store action.
- Drop the SchemaLookup clear test that drove an event the real
  component never emits; add coverage for the canonical-name commit,
  the no-op re-emit, the load-failure path, and offset pagination.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A Schema could be saved with a relation-type property whose relation
(edge label) or targetSchema was empty or whitespace-only: the save-time
JSON Schema used additionalProperties:true and never constrained those
fields. An empty relation type then crashed Neo4j projection when a
Subject populated the relation, via Cypher::escape('') throwing — for a
user who need not be the one who saved the schema. An empty targetSchema
was only caught at read time by SchemaName('').

Add an if/then to schemaContentSchema.json: when a property definition's
type is "relation", relation and targetSchema are required and must
contain a non-whitespace character. This rejects the invalid schema at
save time through the existing SchemaContentValidator, the same path
that already rejects an empty type, rather than corrupting on read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes #955

The layout creator selected the Layout's Schema with a plain CdxSelect
fed by a separate getSchemaNames('') call (names only, no descriptions,
no type-to-filter). Replace it with the shared SchemaLookup component,
which browses the full schema list, filters as you type, shows schema
descriptions, and reuses the cached all-schemas summary load — matching
the subject creator and relation-property pickers.

onSchemaSelected now receives the picked schema name (SchemaLookup only
commits an exact existing schema), and the dead getSchemaNames load and
its now-orphaned placeholder message are removed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The Vue picker component shared its name with the unrelated SchemaLookup
data-access interface (application/SchemaLookup.ts) — public-api.ts even
re-exported both under the name SchemaLookup (one as a type, one as a
value). Rename the component, its placeholder message, and its CSS class
to SchemaPicker so the UI picker and the data-access lookup are clearly
distinct. The data interface keeps the SchemaLookup name, paired with
SchemaRepository.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Follows the SchemaLookup-to-SchemaPicker component rename merged from the
base branch.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Base automatically changed from feature/browse-schema-picker to master June 27, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant