Let a settings value read its own JSON forms

@JsonForms(Codec) marks a value packs write in more than one shape, such as a number, a [min, max]
range or a curve object. The host hands its JSON to the codec as plain values and writes it back
through it; it never creates the class or reads its fields, and the schema describes it as any
JSON value. It is the one exception to the decoding contract, so module jars no longer need Gson
(which the plugin relocates) for such values.
This commit is contained in:
piexel committed 2026-11-05 23:00:05 +01:00
1 parent 5e85e1e3b8
commit 321ab5b486
5 files changed
+97 -3

No files matched your search

+4
View File
@@ -870,6 +870,10 @@ Every settings class, value type and pack resource kind is read the same way, by
- The host creates the instance with the no-argument constructor and reads each JSON member into the field of the
same name. It calls no setter and no other constructor.
- A class annotated `@JsonForms(Codec.class)` is the one exception: a value packs write in several shapes, such as a
number, a `[min, max]` range or a curve object. The host reads its JSON as plain values (maps, lists, `Double`s,
strings, booleans), hands them to the codec, and writes the value back through it. It never creates the class or
reads its fields, and studio describes it as any JSON value.
- A member the JSON leaves out keeps the field's initialiser. A member written as `null` counts as left out.
- The host never writes `null` into a field. An enum name the enum does not know is an error that lists the known
names; it does not become `null` or the default.