obulat commented on issue #27157: URL: https://github.com/apache/airflow/issues/27157#issuecomment-2564162695
We recently ran into this issue in [Openverse](https://github.com/wordpress/openverse). We have an array of objects in a JSON variable to determine whether to send a Slack notification or not. When updating the value using the UI, we accidentally left the trailing comma (`[{"object1", "value1"},]`). Because of this, `json.loads` threw an error, and the DAG failed. It is very easy to make such an mistake when setting or updating a JSON variable using the UI, without a linter. I would love to contribute here, but I'm not sure how. @bbovenzi, where would adding a check make sense in the new UI code? There is no indication if the variable will be parsed as JSON, or as string, in the [Add Variable Form](https://github.com/apache/airflow/blob/51fea3e7fb3c4f35f6f3893139baf80e4e3634d2/airflow/ui/src/pages/Variables/AddVariableForm.tsx). There could be a check to see if the value contains `{` or `[` symbols, and show a toast before saving if the value is not a valid JSON. This way, the user can still save the value if it's not actually a JSON value, and will be aware that the value needs to be fixed if it _is_ JSON. -- 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]
