Skip to content

feat: centralize schema ux templates - #35

Merged
jinbagi merged 1 commit into
masterfrom
codex/schema-ux-todo-improvements
Jul 3, 2026
Merged

feat: centralize schema ux templates#35
jinbagi merged 1 commit into
masterfrom
codex/schema-ux-todo-improvements

Conversation

@jinbagi

@jinbagi jinbagi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a Schema UX TODO checklist for the remaining schema-driven authoring pain points
  • Move plugin JSON template/default generation into a shared JSON Schema template utility
  • Reuse the same placeholder logic from SchemaForm variant/item defaults and PluginEditorDrawer JSON templates
  • Add regression coverage for union required fields, conditional plugin requirements, and required array items

Verification

  • .\node_modules.bin\tsc.CMD -b --pretty false
  • .\node_modules.bin\eslint.CMD src/components/schema-form/schemaTemplate.ts src/components/schema-form/SchemaForm.tsx src/components/form-slice/FormItemPlugins/PluginEditorDrawer.tsx e2e/tests/schema-template.spec.ts --max-warnings=0 --no-warn-ignored
  • E2E_TARGET_URL=http://127.0.0.1:55173/ui/ playwright test e2e/tests/schema-template.spec.ts --reporter=list --workers=1
  • E2E_TARGET_URL=http://127.0.0.1:55173/ui/ playwright test e2e/tests/resource-required-templates.spec.ts --config=.tmp-playwright-chrome.config.ts --project=chrome --reporter=list --workers=1
  • corepack pnpm lint
  • corepack pnpm build

Copilot AI review requested due to automatic review settings July 3, 2026 17:14
@jinbagi
jinbagi merged commit 03d0d50 into master Jul 3, 2026
@jinbagi
jinbagi deleted the codex/schema-ux-todo-improvements branch July 3, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes JSON Schema-driven placeholder/template generation into a shared utility so both the schema-based form UI and the plugin JSON editor generate consistent “minimal valid” templates from the same rules.

Changes:

  • Added schemaTemplate.ts utility to generate templates/placeholders and apply schema defaults across oneOf/anyOf, if/then, and required fields.
  • Updated SchemaForm and PluginEditorDrawer to reuse the shared placeholder/template logic.
  • Added Playwright regression coverage for union required fields, conditional requirements, and required array items; added a schema UX TODO checklist doc.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/components/schema-form/schemaTemplate.ts New shared JSON Schema template/default/placeholder utilities.
src/components/schema-form/SchemaForm.tsx Reuses centralized placeholder logic for schema form defaults.
src/components/form-slice/FormItemPlugins/PluginEditorDrawer.tsx Switches plugin JSON templating/defaulting to shared utility.
e2e/tests/schema-template.spec.ts New regression tests for template generation edge cases.
docs/design/schema-ux-todo.md Adds a checklist documenting remaining schema-driven UX gaps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +165 to +170
if (type === 'array') {
if (resolvedSchema.minItems && resolvedSchema.minItems > 0 && resolvedSchema.items) {
return [placeholderForJsonSchema(resolvedSchema.items, rootSchema)];
}
return [];
}
Comment on lines +92 to +98
if (isRecord(base[key]) && hasSchemaProperties(propSchema)) {
base[key] = applyJsonSchemaDefaults(
propSchema,
base[key] as Record<string, unknown>,
root
);
}
Comment on lines +227 to +232
if (isRecord(value) && propSchema) {
const resolvedPropSchema = getResolvedSchema(propSchema, root);
if (hasSchemaProperties(resolvedPropSchema)) {
base[key] = buildJsonSchemaTemplate(resolvedPropSchema, value, root);
}
}
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.

2 participants