core
core copied to clipboard
Enhancement capturing data for ContentTypes systemActionMapping and Relationships
Parent Issue
https://github.com/dotCMS/core/issues/28684
Problem Statement
here's a little enhancement that I would like to see in the parent issue:
We need to validate that the labels we use to push in the systemActionMapping are valid Like: "NEW","EDIT","UNPUBLISH","UNARCHIVE"
if for example I send a descriptor like this:
{
"clazz" : "SimpleContentType",
"id" : "e855a5dfeaed481dd4afd07b1bdac9d4",
"name" : "MyTestContentType",
"variable" : "MyTestContentType",
"modDate" : "2024-08-27T19:06:04.000+00:00",
"iDate" : "2024-08-27T18:27:45.000+00:00",
"host" : "48190c8c-42c4-46af-8d1a-0cd5db894797",
"folder" : "SYSTEM_FOLDER",
"siteName" : "demo.dotcms.com",
"folderPath" : "/",
"icon" : "event_note",
"baseType" : "CONTENT",
"metadata" : {
"CONTENT_EDITOR2_ENABLED" : false
},
"workflows" : [ {
"id" : "2a4e1d2e-5342-4b46-be3d-80d3a2d9c0dd",
"variableName" : "Blogs"
} ],
"systemActionMappings" : {
"LOL" : "8d567403-a201-42de-9a48-10cea8a7bdb2"
},
"dotCMSObjectType" : "ContentType"
}
The values don't get saved or anything But I am pretty sure some users would find it helpful a little insight warning them about the misleading label captured.
The returning file looks like this :
{
"clazz" : "SimpleContentType",
"id" : "e855a5dfeaed481dd4afd07b1bdac9d4",
"name" : "MyTestContentType",
"variable" : "MyTestContentType",
"modDate" : "2024-08-27T19:32:20.000+00:00",
"iDate" : "2024-08-27T18:27:45.000+00:00",
"host" : "48190c8c-42c4-46af-8d1a-0cd5db894797",
"folder" : "SYSTEM_FOLDER",
"siteName" : "demo.dotcms.com",
"folderPath" : "/",
"icon" : "event_note",
"baseType" : "CONTENT",
"metadata" : {
"CONTENT_EDITOR2_ENABLED" : false
},
"workflows" : [ {
"id" : "2a4e1d2e-5342-4b46-be3d-80d3a2d9c0dd",
"variableName" : "Blogs"
} ],
"dotCMSObjectType" : "ContentType"
}
We need at least a warning
- For me this is not a valid reason to reject an issue. But we have seen QA complaining about this type of things. So I'm gonna leave this here as an optional improvement. Perhaps a good candidate for a gardening day task.
If I send a value outside the accepted labels to describe a relationship type we get a error like this:
[ERROR] ❗ Error in command [push] with message:
Error mapping file [/Users/fabrizzioaraya/local-install/content-types/MyContentType.json] for type [com.dotcms.contenttype.model.type.ContentType]
Invalid name: ONE_TO_MANY1 (through reference chain: com.dotcms.contenttype.model.type.ImmutableSimpleContentType$Json["fields"]->java.util.ArrayList[3]->com.dotcms.contenttype.model.field.ImmutableRelationshipField$Json["relationships"]->com.dotcms.contenttype.model.field.ImmutableRelationships$Json["cardinality"])
run with -e or --errors for full details on the exception.
which is perfectly fine in my opinion, but .. it might seem too java for some so we might want to add a validation to ensure the values captured are ok describing a relationship type like: MANY_TO_MANY, ONE_TO_MANY, MANY_TO_ONE y ONE_TO_ONE
another enhancement suggested is being able to use a lowercase version of the those values. As it can be seen below the push failed because of using one_to_many instead of MANY_TO_MANY
[ERROR] ❗ Error in command [push] with message:
Error mapping file [/Users/fabrizzioaraya/content-types/MyContentType.json] for type [com.dotcms.contenttype.model.type.ContentType]
Invalid name: **one_to_many** (through reference chain: com.dotcms.contenttype.model.type.ImmutableSimpleContentType$Json["fields"]->java.util.ArrayList[3]->com.dotcms.contenttype.model.field.ImmutableRelationshipField$Json["relationships"]->com.dotcms.contenttype.model.field.ImmutableRelationships$Json["cardinality"])
run with -e or --errors for full details on the exception.
Steps to Reproduce
- Save a CT descriptor using systemActionMappings in conjunction with an invalid Label
- Save a CT descriptor using in a relationship field an invalid label
Acceptance Criteria
So to recap a better message validating the labels we use and allowing lowercase values of them
dotCMS Version
current trunk
Proposed Objective
User Experience
Proposed Priority
Priority 4 - Trivial
External Links... Slack Conversations, Support Tickets, Figma Designs, etc.
No response
Assumptions & Initiation Needs
No response
Quality Assurance Notes & Workarounds
No response
Sub-Tasks & Estimates
No response