Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Support non latin characters in schema names #5063

Merged
merged 13 commits into from
Apr 23, 2024

Conversation

ijreilly
Copy link
Collaborator

@ijreilly ijreilly commented Apr 19, 2024

Fixes #4943

How was it tested?

Local (front + /metadata)
Unit tests for utils

@@ -30,6 +30,7 @@
"lodash.uniqby": "^4.7.0",
"passport": "^0.7.0",
"psl": "^1.9.0",
"transliteration": "^2.3.5",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ijreilly ijreilly marked this pull request as ready for review April 19, 2024 14:49
@ijreilly ijreilly requested a review from Weiko April 19, 2024 14:49
Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, left a few comments! 👏

@@ -1,4 +1,4 @@
const metadataLabelValidationPattern = /^[a-zA-Z][a-zA-Z0-9 ]*$/;
const metadataLabelValidationPattern = /^[^0-9].*$/;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ijreilly with this regex we don't exclude special characters which will also break in the BE for field creations


const VALID_STRING_PATTERN = /^[a-zA-Z][a-zA-Z0-9 ]*$/;

export const formatMetadataLabel = (string: string): string => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually maybe formatMetadataLabelToMetadataName is more explicit? Wdyt

@@ -0,0 +1,9 @@
import { InvalidStringException } from 'src/engine/metadata-modules/errors/InvalidStringException';

const VALID_STRING_PATTERN = /^[a-zA-Z][a-zA-Z0-9 ]*$/;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the pattern here is not the same as the FE pattern

Copy link
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Good job! @ijreilly

@Weiko Weiko merged commit ff39ba5 into main Apr 23, 2024
10 checks passed
@Weiko Weiko deleted the fix--support-non-latin-char-2 branch April 23, 2024 11:37
arnavsaxena17 pushed a commit to arnavsaxena17/twenty that referenced this pull request Oct 6, 2024
Fixes twentyhq#4943

## How was it tested?
Local (front + /metadata)
Unit tests for utils

---------

Co-authored-by: Weiko <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating an object/field with a name not compliant with GraphQL type names breaks the schema
2 participants