@remoteoss/remote-json-schema-form-kit
v1.1.2
Published
Remote's kit for json-schema-form
Readme
remote-json-schema-form-kit
Remote's wrapper around @remoteoss/json-schema-form (JSF) with added JSON logic operators.
This package exposes the two JSF versions v0 (legacy) and v1 (new). v1 is the default — a schema only runs on v0 if it explicitly opts out.
Installation
npm install @remoteoss/remote-json-schema-form-kitUsage
import { createHeadlessForm, modify } from '@remoteoss/remote-json-schema-form-kit';How version routing works
This package exposes the two JSF versions we use:
- v0 (legacy) —
@remoteoss/[email protected] - v1 —
@remoteoss/[email protected]
When you call createHeadlessForm(schema, options) or modify(schema, options), the kit checks schema["x-rmt-meta"].jsfOldVersion === true (schema-level marker set when consuming schemas via API).
If that marker is set, the call is forwarded to the v0 implementation. Otherwise — including when x-rmt-meta is absent entirely — it uses the v1 implementation. There is no caller-side flag to override this; the schema's own marker is the only way to opt into v0.
For v1, the kit also injects:
- Custom JSON Logic operators via
customJsonLogicOps - Legacy compatibility options (
treatNullAsUndefined,allowForbiddenValues)
TypeScript types (v0 vs v1)
The kit already disambiguates some overlapping concepts. All types are v1 by default. Some types for v0 has a *Legacy suffix, for example ModifyConfigLegacy, FieldLegacy, etc.
CONTRIBUTING
This project was previously in Github, but it has moved to our internal private monorepo to improve the DX when updating JSF. We might consider doing a new mirror on Github for transparency. If you need it, let us know!
Adding a new custom JSON Logic operator
- Create a new file in
src/json-logic-operators/and write tests (follow the existing pattern, e.g.dateAddDays.ts) - Export it from
src/json-logic-operators/index.tsin theoperatorsobject - The key in the
operatorsobject is the operator name used in JSON Schemas (e.g.date_add_days)
Deploy
Read README_internal.md for more info.
