@acellera/pm-rjsf
v0.0.7
Published
Shared RJSF renderer for PlayMolecule v2 (JSON Schema) manifests — used by pmview and the pmmanifest preview.
Readme
@acellera/pm-rjsf
The shared RJSF (Material-UI) renderer for PlayMolecule v2 manifests — the
JSON Schema (inputSchema) + uiSchema produced by
pmmanifest. One implementation,
consumed by both pmview and the pmmanifest dev preview, so they render
identically.
Why a separate package
The canonical inputSchema stays a faithful Pydantic JSON Schema (it's what the
backend stages files against, what the SDK reconstructs signatures from, and
what input validation uses). The RJSF-specific presentation lives here:
- AJV 2020 validator (Pydantic emits 2020-12; RJSF's default is draft-07).
- Render-time transforms (
prepareForRjsf): collapseOptional(anyOf[X, null]) to a clean field, label discriminated-oneOfoptions from the discriminator, and strip platform-managed dirs (outdir/scratchdir/execdir). - MUI templates: grouped accordions (
ui:options.group), flat arrays,additionalPropertiesmaps with custom key labels (ui:options.keyLabel),?-tooltip descriptions, small field titles, hidden discriminators.
These are presentation only — never mutate the canonical schema with them.
Use in pmview (Vite)
npm install @acellera/pm-rjsfimport { PMForm } from "@acellera/pm-rjsf";
// For a v2 manifest function entry { inputSchema, uiSchema }:
<PMForm schema={fn.inputSchema} uiSchema={fn.uiSchema} onSubmit={({ formData }) => run(formData)} />(pmview keeps its existing bespoke renderer for v1 manifests; this is used only
when manifestVersion === 2 / an inputSchema is present.)
Use in the pmmanifest preview (no build step)
Once published, the preview imports it from a CDN like its other deps:
import { PMForm } from "https://esm.sh/@acellera/pm-rjsf";
root.render(React.createElement(PMForm, { schema, uiSchema, onSubmit }));Build
npm install
npm run build # -> dist/pm-rjsf.js (ESM)React, react-dom, MUI and emotion are peer dependencies (the consumer
provides them); @rjsf/* and ajv are bundled-as-dependencies.
