Backend: Validate if the entity names are valid in terms of Name, Fqn
On Creating an entity with special characters like quotes, backend should not allow creation of it since they are reserved keywords, we will provide support if someone faces this issue by adding in the custom basemodel / custom pydantic code
Payload to create - Json column with quotes in between, similar issues happen for dashboard data models
{
"name": "table_entity",
"tableType": "Regular",
"columns": [
{
"name": "id",
"displayName": "",
"dataType": "BOOLEAN",
"dataLength": 36,
"dataTypeDisplay": "varchar(36)",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.id",
"tags": [],
"ordinalPosition": 1,
"children": [],
"customMetrics": []
},
{
"name": "jso\"n\"",
"displayName": "",
"dataType": "JSON",
"dataLength": 1,
"dataTypeDisplay": "json",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.json",
"tags": [],
"constraint": "NOT_NULL",
"ordinalPosition": 2,
"children": [],
"customMetrics": []
},
{
"name": "updatedAt",
"displayName": "",
"dataType": "BIGINT",
"dataLength": 1,
"dataTypeDisplay": "bigint",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.updatedAt",
"tags": [],
"constraint": "NULL",
"ordinalPosition": 3,
"children": [],
"customMetrics": []
},
{
"name": "updatedBy",
"displayName": "",
"dataType": "VARCHAR",
"dataLength": 256,
"dataTypeDisplay": "varchar(256)",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.updatedBy",
"tags": [],
"constraint": "NULL",
"ordinalPosition": 4,
"children": [],
"customMetrics": []
},
{
"name": "deleted",
"displayName": "",
"dataType": "TINYINT",
"dataLength": 1,
"dataTypeDisplay": "tinyint",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.deleted",
"tags": [],
"constraint": "NULL",
"ordinalPosition": 5,
"children": [],
"customMetrics": []
},
{
"name": "fqnHash",
"displayName": "",
"dataType": "VARCHAR",
"dataLength": 768,
"dataTypeDisplay": "varchar(768)",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.fqnHash",
"tags": [],
"constraint": "UNIQUE",
"ordinalPosition": 6,
"children": [],
"customMetrics": []
},
{
"name": "name",
"displayName": "",
"dataType": "VARCHAR",
"dataLength": 256,
"dataTypeDisplay": "varchar(256)",
"description": "",
"fullyQualifiedName": "sample_data.ecommerce_db.shopify.table_entity.name",
"tags": [],
"constraint": "NOT_NULL",
"ordinalPosition": 7,
"children": [],
"customMetrics": []
}
],
"tableConstraints": [],
"owners": [],
"databaseSchema": "sample_data.ecommerce_db.shopify"
}
@harshach Hi, I've a background in backend dev and I'd like to fix this by adding name/FQN validation in the base model to reject special characters like quotes and newlines. Requesting assignment. I'll raise a PR for the same after checking the codebase.
@jaya6400 assigned it to you
I've raised a PR for this fix: #27521.
It updates the regex patterns in basic.json and table.json to block reserved FQN characters (>, ") and control characters (\x00-\x1f) in entity and column names. Ready for maintainer's review.
Hi, I'd like to work on this issue. I have experience with Java and Spring Boot backend development. Can you assign it to me?
Sorry, I just noticed this issue is already being worked on. I will pick up another issue. Thanks!
Hi, I’m interested in working on this as my first contribution to OpenMetadata. I’m a CS student with backend experience in Java, Spring Boot, PostgreSQL, validation logic, and API workflows. Could I be assigned to this issue?
@Moustafa-Ameen hi, I am already working on this PR, waiting for maintainer re-review on my PR comment.
- https://github.com/open-metadata/OpenMetadata/pull/27886#issuecomment-4754296398