techolga opened a new issue, #39972:
URL: https://github.com/apache/airflow/issues/39972

   ### Apache Airflow version
   
   2.9.1
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   When I try to add item validation to an array type in the schema of a Param 
object passed to a DAG, the UI does render a Code box instead of an Array box 
and does not validate the jsonschema properly. 
   
   ### What you think should happen instead?
   
   It should render the same UI element as it does when there is no field 
"items" in the schema.
   
   ### How to reproduce
   
   ```python
   @dag(
       schedule=None,
       params={
           "mail": Param(
               schema={
                   "title": "Email addresses",
                   "type": ["array", "null"],
                   # The following causes the issue (even "items": {} is enough)
                   "items": {
                       "type": "string",
                       "format": "idn-email",
                       "minLength": 5,
                       "maxLength": 255,
                   },
               }
           ),
       },
   )
   def any_dag():
        ...
   ```
   
   Test validation in REPL:
   
   ```python
   import jsonschema
   schema={
       "type": ["array", "null"],
       "items": {
           "type": "string",
           "format": "idn-email",
           "minLength": 5,
           "maxLength": 255,
       },
   }
   jsonschema.validate(['[email protected]'], schema, 
format_checker=jsonschema.FormatChecker())
   # does not raise an exception
   
   jsonschema.validate(['testmail.com'], schema, 
format_checker=jsonschema.FormatChecker())
   # does raise an exception
   ```
   
   ### Operating System
   
   Debian GNU/Linux 12 (bookworm)
   
   ### Versions of Apache Airflow Providers
   
   apache-airflow-providers-amazon==8.20.0
   apache-airflow-providers-celery==3.6.2
   apache-airflow-providers-cncf-kubernetes==8.1.1
   apache-airflow-providers-common-io==1.3.1
   apache-airflow-providers-common-sql==1.12.0
   apache-airflow-providers-docker==3.10.0
   apache-airflow-providers-elasticsearch==5.3.4
   apache-airflow-providers-fab==1.0.4
   apache-airflow-providers-ftp==3.8.0
   apache-airflow-providers-google==10.17.0
   apache-airflow-providers-grpc==3.4.1
   apache-airflow-providers-hashicorp==3.6.4
   apache-airflow-providers-http==4.10.1
   apache-airflow-providers-imap==3.5.0
   apache-airflow-providers-microsoft-azure==10.0.0
   apache-airflow-providers-mysql==5.5.4
   apache-airflow-providers-odbc==4.5.0
   apache-airflow-providers-openlineage==1.7.0
   apache-airflow-providers-postgres==5.10.2
   apache-airflow-providers-redis==3.6.1
   apache-airflow-providers-sendgrid==3.4.0
   apache-airflow-providers-sftp==4.9.1
   apache-airflow-providers-slack==8.6.2
   apache-airflow-providers-smtp==1.6.1
   apache-airflow-providers-snowflake==5.4.0
   apache-airflow-providers-sqlite==3.7.1
   apache-airflow-providers-ssh==3.10.1
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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