Fixes #16760: Remove maxLength for tagFQN (#16794)

This commit is contained in:
Ayush Shah 2024-06-26 21:14:07 +05:30 committed by GitHub
parent d083bd1365
commit 527b714d34
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 31 additions and 3 deletions

View File

@ -108,7 +108,9 @@ BAD_RESPONSE = {
],
"tags": [
{
"tagFQN": "myTaghasMoreThanOneHundredAndTwentyCharactersAndItShouldBreakPydanticModelValidation.myTaghasMoreThanOneHundredAndTwentyCharactersAndItShouldBreakPydanticModelValidation",
# Certain test cases are expected to fail as tagFQN's
# value is not a string to test out the skip_on_failure
"tagFQN": 123,
"source": "Classification",
"labelType": "Manual",
"state": "Confirmed",

View File

@ -25,6 +25,8 @@ CLASSIFICATION_NAME = "TestTag"
PRIMARY_TAG_NAME = "TestPrimaryTag"
SECONDARY_TAG_NAME = "TestSecondaryTag"
TEST_SPECIAL_CHARS_TAG_NAME = "Test/Sepcial_Chars/Tag"
LONG_CLASSIFICATION_NAME = "A" * 256
LONG_PRIMARY_TAG_NAME = "B" * 256
class OMetaTagMixinPost(TestCase):
@ -132,3 +134,28 @@ class OMetaTagMixinPost(TestCase):
).entities
self.assertIsNotNone(tags)
def test_c_create_classifications(self):
"""Test POST classification for long name"""
classification = CreateClassificationRequest(
description="test tag", name=LONG_CLASSIFICATION_NAME
)
classification: Classification = self.metadata.create_or_update(classification)
self.assertEqual(classification.name.root, LONG_CLASSIFICATION_NAME)
def test_d_create_tag(self):
"""Test POST tag creation with long name"""
create_primary_tag = CreateTagRequest(
name=LONG_PRIMARY_TAG_NAME,
classification=LONG_CLASSIFICATION_NAME,
description="test tag",
)
primary_tag: Tag = self.metadata.create_or_update(create_primary_tag)
self.assertEqual(primary_tag.name.root, LONG_PRIMARY_TAG_NAME)
self.assertEqual(
primary_tag.fullyQualifiedName,
f"{LONG_CLASSIFICATION_NAME}.{LONG_PRIMARY_TAG_NAME}",
)

View File

@ -7,8 +7,7 @@
"javaType": "org.openmetadata.schema.type.TagLabel",
"definitions": {
"tagFQN": {
"type": "string",
"maxLength": 128
"type": "string"
},
"TagSource": {
"type": "string",