Skip to content

Commit e6c6742

Browse files
authored
fix: WebComponent supported types (#22938)
Fix WebComponentExporter supported types to have serializable BaseJsonNode instead of JsonNode. Fixes #22935
1 parent c197e75 commit e6c6742

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

flow-server/src/main/java/com/vaadin/flow/component/WebComponentExporter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public abstract class WebComponentExporter<C extends Component>
9595
private static final List<Class> SUPPORTED_TYPES = Collections
9696
.unmodifiableList(
9797
Arrays.asList(Boolean.class, String.class, Integer.class,
98-
Double.class, JsonValue.class, JsonNode.class));
98+
Double.class, JsonValue.class, BaseJsonNode.class));
9999

100100
private final String tag;
101101
private HashMap<String, PropertyConfigurationImpl<C, ? extends Serializable>> propertyConfigurationMap = new HashMap<>();

flow-server/src/test/java/com/vaadin/flow/server/startup/WebComponentConfigurationRegistryInitializerTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import com.vaadin.flow.component.webcomponent.WebComponent;
4545
import com.vaadin.flow.component.webcomponent.WebComponentConfiguration;
4646
import com.vaadin.flow.internal.CurrentInstance;
47+
import com.vaadin.flow.internal.JacksonUtils;
4748
import com.vaadin.flow.server.InvalidCustomElementNameException;
4849
import com.vaadin.flow.server.MockInstantiator;
4950
import com.vaadin.flow.server.VaadinContext;
@@ -188,6 +189,14 @@ public void duplicatePropertyRegistration_doesNotCauseIssues()
188189
servletContext);
189190
}
190191

192+
@Test
193+
public void jacksonPropertyRegistration_doesNotCauseIssues()
194+
throws ServletException {
195+
initializer.process(
196+
Collections.singleton(JacksonPropertyExporter.class),
197+
servletContext);
198+
}
199+
191200
@Test
192201
public void duplicatePropertyRegistrationBetweenParentAndChild_doesNotCauseIssues()
193202
throws ServletException {
@@ -328,6 +337,22 @@ public void configureInstance(WebComponent<MyComponent> webComponent,
328337
}
329338
}
330339

340+
public static class JacksonPropertyExporter
341+
extends WebComponentExporter<MyComponent> {
342+
343+
public JacksonPropertyExporter() {
344+
super("tag-2");
345+
addProperty("property",
346+
JacksonUtils.createObjectNode().put("foo", "bar"));
347+
}
348+
349+
@Override
350+
public void configureInstance(WebComponent<MyComponent> webComponent,
351+
MyComponent component) {
352+
353+
}
354+
}
355+
331356
public static class CauseMatcher extends BaseMatcher<Throwable> {
332357
private final Class<? extends Throwable> throwableType;
333358
private boolean startsWith = false;

0 commit comments

Comments
 (0)