Feature proposal
LitRenderer.withFunction(name, handler) registers a client-callable function whose arguments are delivered to the server-side handler as a JSON array. The handler signature differs by Vaadin version:
- Vaadin ≤24: the handler receives an
elemental.json.JsonArray.
- Vaadin 25+: Vaadin switched its JSON layer to Jackson, so the same handler now receives a
com.fasterxml.jackson.databind.node.ArrayNode.
Code written against the elemental.json signature (SerializableBiConsumer<SOURCE, JsonArray>) therefore breaks on Vaadin 25. JsonMigrationHelper should offer a compatibility helper so a single withFunction handler written against elemental.json.JsonArray works unchanged across Vaadin 24 and 25+, consistent with the rest of the add-on's JSON compatibility surface (setPropertyJson, executeJs, getEventData, @ClientCallable/@LegacyClientCallable, …).
Describe solution expectations
A static helper, e.g.:
LitRendererMigrationExtension.withFunction(renderer, name, (source, JsonArray args) -> { ... });
- On Vaadin <25, delegate directly to
renderer.withFunction(name, handler).
- On Vaadin 25+, wrap the handler so the incoming
ArrayNode is converted to JsonArray via JsonMigration.convertToJsonValue(...) before the user handler is invoked.
- Since the library compiles against Vaadin 14 (where
LitRenderer does not exist), the LitRenderer reference would be resolved at build time using the same ASM post-processing mechanism already used elsewhere in the project.
- Usable with Lombok
@ExtensionMethod(JsonMigration.class) for fluent syntax.
Additional information
This is the LitRenderer counterpart to the JSON elemental.json ↔ Jackson conversion the add-on already provides for other Vaadin APIs.
Feature proposal
LitRenderer.withFunction(name, handler)registers a client-callable function whose arguments are delivered to the server-side handler as a JSON array. The handler signature differs by Vaadin version:elemental.json.JsonArray.com.fasterxml.jackson.databind.node.ArrayNode.Code written against the elemental.json signature (
SerializableBiConsumer<SOURCE, JsonArray>) therefore breaks on Vaadin 25. JsonMigrationHelper should offer a compatibility helper so a singlewithFunctionhandler written againstelemental.json.JsonArrayworks unchanged across Vaadin 24 and 25+, consistent with the rest of the add-on's JSON compatibility surface (setPropertyJson,executeJs,getEventData,@ClientCallable/@LegacyClientCallable, …).Describe solution expectations
A static helper, e.g.:
renderer.withFunction(name, handler).ArrayNodeis converted toJsonArrayviaJsonMigration.convertToJsonValue(...)before the user handler is invoked.LitRendererdoes not exist), theLitRendererreference would be resolved at build time using the same ASM post-processing mechanism already used elsewhere in the project.@ExtensionMethod(JsonMigration.class)for fluent syntax.Additional information
This is the LitRenderer counterpart to the JSON elemental.json ↔ Jackson conversion the add-on already provides for other Vaadin APIs.