Skip to content

Add schema manifest output and CLI#4

Merged
PatrickJS merged 1 commit into
mainfrom
codex/schema-manifest-defaults
May 12, 2026
Merged

Add schema manifest output and CLI#4
PatrickJS merged 1 commit into
mainfrom
codex/schema-manifest-defaults

Conversation

@PatrickJS
Copy link
Copy Markdown
Owner

@PatrickJS PatrickJS commented May 12, 2026

Introduce committed JSON schema manifest generation for model-driven admin/CMS UIs. Adds a new generator (src/schema-manifest.js) and exports generateSchemaManifest/renderSchemaManifest from the public API and CLI. New config options schemaOutFile and schemaManifest (customizeField hook) are supported, and schemaOutFile is resolved in loadConfig. The sync flow writes the manifest when configured, and a new CLI subcommand jsondb schema manifest [--out ] is implemented. Type definitions, Vite plugin options, README, SPEC, and example config are updated, and comprehensive tests were added to verify UI inference, nested/array/relation handling, customizeField overrides/omissions, serialization diagnostics, and CLI output.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added schema manifest generation for model-driven admin and CMS UIs
    • New CLI command: jsondb schema manifest --out <file> to generate manifests
    • Support for customizing field metadata and UI component mappings via configuration hooks
  • Documentation

    • Updated README.md with schema manifest feature overview and usage examples
    • Updated SPEC.md with detailed specification and configuration documentation
  • Tests

    • Added comprehensive test coverage for manifest generation, customization, and CLI integration

Review Change Stack

Introduce committed JSON schema manifest generation for model-driven admin/CMS UIs. Adds a new generator (src/schema-manifest.js) and exports generateSchemaManifest/renderSchemaManifest from the public API and CLI. New config options schemaOutFile and schemaManifest (customizeField hook) are supported, and schemaOutFile is resolved in loadConfig. The sync flow writes the manifest when configured, and a new CLI subcommand jsondb schema manifest [--out <file>] is implemented. Type definitions, Vite plugin options, README, SPEC, and example config are updated, and comprehensive tests were added to verify UI inference, nested/array/relation handling, customizeField overrides/omissions, serialization diagnostics, and CLI output.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc0f585a-f43a-4c17-867c-c5bf1c6f8d3c

📥 Commits

Reviewing files that changed from the base of the PR and between d38aa6b and 860d908.

📒 Files selected for processing (11)
  • README.md
  • SPEC.md
  • jsondb.config.example.mjs
  • src/cli.js
  • src/config.js
  • src/index.d.ts
  • src/index.js
  • src/schema-manifest.js
  • src/sync.js
  • src/vite.d.ts
  • test/jsondb.test.js

📝 Walkthrough

Walkthrough

This PR introduces a schema manifest feature that generates a JSON metadata file describing the jsondb schema structure, inferred UI components for form generation, and support for customizing per-field output via config hooks.

Changes

Schema Manifest Feature

Layer / File(s) Summary
Schema Manifest Generation Engine
src/schema-manifest.js
Core manifest rendering with versioned structure, per-resource/field metadata, UI component inference from field types/names, customization hook support with diagnostics, and JSON serializability validation.
Configuration, Type Definitions, and Public API
src/config.js, src/index.d.ts, src/index.js, jsondb.config.example.mjs, src/vite.d.ts
Configuration defaults for schemaOutFile and schemaManifest, path resolution in config loader, TypeScript type definitions for field context and manifest options, public function exports, and Vite plugin option updates.
CLI Command and Sync Integration
src/cli.js, src/sync.js
New jsondb schema manifest --out subcommand with output handling and help text; automatic manifest generation during jsondb sync when schemaOutFile is configured.
Feature Documentation
README.md, SPEC.md, jsondb.config.example.mjs
README configuration table entry and detailed "Schema Manifest Output" section, SPEC manifest format definition and customizeField hook contract, and example config with field customization patterns for markdown fields.
Test Coverage
test/jsondb.test.js
Tests validating manifest generation with UI defaults, schema defaults in nested/array/relation fields, per-field customization and omission, rejection of non-serializable output, and CLI command with --cwd respect.

Sequence Diagram

sequenceDiagram
  participant User as User/CLI
  participant sync as syncJsonFixtureDb
  participant generateSchemaManifest
  participant renderSchemaManifest
  participant renderFieldManifest
  participant customizeField as customizeField Hook
  User->>sync: jsondb sync or schema manifest --out
  sync->>generateSchemaManifest: config + options
  generateSchemaManifest->>renderSchemaManifest: load resources
  renderSchemaManifest->>renderFieldManifest: each field in resource
  renderFieldManifest->>customizeField: field context + default manifest
  customizeField-->>renderFieldManifest: customized manifest or null
  renderFieldManifest-->>renderSchemaManifest: field metadata
  renderSchemaManifest-->>generateSchemaManifest: versioned manifest
  generateSchemaManifest->>generateSchemaManifest: serialize + write JSON
  generateSchemaManifest-->>sync: manifest + output paths
  sync-->>User: logged file paths / stdout content
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PatrickJS/jsondb#3: Updates Vite plugin TypeScript options to include additional JsonDbOptions keys, overlapping with the schemaOutFile and schemaManifest option additions to the plugin options type.

Poem

A manifest blooms from schema seeds,
UI hints for forms we need,
Customizable field by field,
Admin UIs are now revealed! 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/schema-manifest-defaults

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@PatrickJS PatrickJS merged commit 7a2e819 into main May 12, 2026
3 of 4 checks passed
@PatrickJS PatrickJS deleted the codex/schema-manifest-defaults branch May 12, 2026 05:42
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