jmix icon indicating copy to clipboard operation
jmix copied to clipboard

Add validation for DynamicAttributes code values (port to 1.x)

Open syncro opened this issue 4 months ago • 1 comments

Environment

Jmix version: 1.6, 2.x is not affected

Bug Description

DynamicAttribues edit form allows to use symbols that can cause errors, e.g. "."

Steps To Reproduce

  1. Create project
  2. Add DynamicAttribues addon
  3. Create entity, screens for it, run application
  4. Add dynamic attribute category and dynamic attribute with name containing dot, add it to entity edit screen. Note: you may need to restart app in order to have settings applied.
  5. Go to entity grid and press add button

Current Behavior

Attribute is created successfully. But Exception is thrown when you try to manage entity connected with it

Caused by: java.lang.IllegalStateException: Could not resolve property path '+Новый.Атрибут' in 'simpledoc$Contract'
	at io.jmix.core.MetadataTools.resolveMetaPropertyPath(MetadataTools.java:974) ~[jmix-core-1.5.999-SNAPSHOT.jar:na]
	at io.jmix.dynattrui.impl.BaseEmbeddingStrategy.checkPermissions(BaseEmbeddingStrategy.java:121) ~[jmix-dynattr-ui-1.5.999-SNAPSHOT.jar:na]
	at io.jmix.dynattrui.impl.BaseEmbeddingStrategy.lambda$findVisibleAttributes$1(BaseEmbeddingStrategy.java:109) ~[jmix-dynattr-ui-1.5.999-SNAPSHOT.jar:na]

Expected Behavior

DyamicAttribute form forbids to save attibutes with dots in name

Note: version 2.x UI already has such validation

image

syncro avatar Oct 08 '24 07:10 syncro