check on label metadata (#12852)

Better catching label input

- there were absolutely no check on label when creating the target field
while doing a relation : we crearted these checks here.

- We keep the label quite open to special char as discussed with Felix.
so mostly checking length of label.
  - We check that label does not already exists on the targetted object


- making sure the Target fieldinput label is checked before we create
it. The previous checks are not enough since the label goes through
anoteher merthod before going in the database

- validate-metadata-name-is-camel-case.utils.ts : making sure we can use
this error message for metadata name and for target label

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
Co-authored-by: prastoin <paul@twenty.com>
This commit is contained in:
Guillim
2025-06-24 20:20:37 +02:00
committed by GitHub
parent 02ce53bd2f
commit fb0cf11499
6 changed files with 40 additions and 15 deletions
@@ -12,6 +12,7 @@ export enum InvalidMetadataExceptionCode {
EXCEEDS_MAX_LENGTH = 'Exceeds max length',
RESERVED_KEYWORD = 'Reserved keyword',
NOT_CAMEL_CASE = 'Not camel case',
NOT_FIRST_LETTER_UPPER_CASE = 'Not first letter upper case',
INVALID_LABEL = 'Invalid label',
NAME_NOT_SYNCED_WITH_LABEL = 'Name not synced with label',
INVALID_STRING = 'Invalid string',