shubhamraj-git commented on code in PR #45089:
URL: https://github.com/apache/airflow/pull/45089#discussion_r1893559986


##########
airflow/api_fastapi/core_api/routes/public/variables.py:
##########
@@ -166,6 +167,21 @@ def post_variable(
     session: SessionDep,
 ) -> VariableResponse:
     """Create a variable."""
+    # Check for key length limit
+    if len(post_body.key) > ID_LEN:
+        raise HTTPException(
+            status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
+            detail=f"Variable key exceeds maximum length of {ID_LEN} 
characters.",
+        )

Review Comment:
   used the same const to keep single source of truth which is 250



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to