gentics / gentics/mesh

"Allow" property on schema field propagates to other String fields and cannot be edited

Open
#1,083 3 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
593
Forks
123
Avg merge
2d 18h
Merged PRs (30d)
4

Description

## Gentics Mesh Version, operating system, or hardware.
- v1.5.1

## Operating System
Docker (Docker Desktop for OSX) via mesh-compose

## Problem
Adding a list of allowed Strings on a String field in a schema propagates the same restricted list of Strings to other String fields in the same schema that are not restricted.

## Reproducer
Create a schema with 1 unrestricted String field, and 1 String field that is restricted to 2 or more String values. Make both fields required. Json prior to saving should look something like this:
```
"fields": [
{
"name": "Title",
"type": "string",
"label": "Title",
"required": true
},
{
"name": "Select1",
"type": "string",
"label": "Selection Test",
"required": true,
"allow": [
"Value1",
"Value2",
"Value3"
]
}
]
```
Save the schema, assign to a project, and reload - either reload in schema editor, or try to create a node using the new schema.

## Expected behaviour and actual behaviour
**Expected**: Schema requires 2 fields. 1 field ("Title" in above example) allows any String. 1 field ("Selection Test" in above example) only allows certain Strings ("Value1", "Value2", "Value3" in above example).

**Actual**: The allowed Strings on the restricted field have propagated to the unrestricted String field (to the "Title" field in the above example). The json returned when reloading the schema is as follows (also note schema field order is not preserved as mentioned in another Issue):
```
"fields": [
{
"name": "Select1",
"type": "string",
"label": "Selection Test",
"required": true,
"allow": [
"Value1",
"Value2",
"Value3"
]
},
{
"name": "Title",
"type": "string",
"label": "Title",
"required": true,
"allow": [
"Value1",
"Value2",
"Value3"
]
}
]
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the schema save and reload flow described in the issue with one unrestricted String field and one restricted String field. Trace how String field definitions are persisted and reconstructed; done means the allow list remains only on the restricted field and the unrestricted field accepts arbitrary strings after reload.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.