You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ScheduleInterval schema in OpenAPI specs should have "nullable: true" otherwise generated OpenAPI client will throw an error in case of nullable "schedule_interval" #22358
Currently we have this schema definition in the OpenAPI specs:
ScheduleInterval:
description: |
Schedule interval. Defines how often DAG runs, this object gets added to your latest task instance's
execution_date to figure out the next schedule.
readOnly: true
oneOf:
- $ref: '#/components/schemas/TimeDelta'
- $ref: '#/components/schemas/RelativeDelta'
- $ref: '#/components/schemas/CronExpression'
discriminator:
propertyName: __type
The issue with above is, when using an OpenAPI generator for Java for example (I think is same for other languages as well), it will treat ScheduleInterval as non-nullable property, although what is returned under /dags/{dag_id} or /dags/{dag_id}/details in case of a Noneschedule_interval is null for schedule_interval.
What you think should happen instead
We should have nullable: true in ScheduleInterval schema which will allow schedule_interval to be parsed as null.
How to reproduce
No response
Operating System
Linux
Versions of Apache Airflow Providers
No response
Deployment
Official Apache Airflow Helm Chart
Deployment details
No response
Anything else
If the maintainers think is a valid bug, I will be more than happy to submit a PR :)
From what I understand, the problem is not in the API response, but the generated API clients. The response you have above is currently not consumable by an API client. Adding nullable: true would allow the clients to handle "schedule_interval": null correctly. The generated API clients are not a part of the main Airflow repository, but they do rely on the openapi/v1.yml file in here, so we need to fix it for them.
Activity
boring-cyborg commentedon Mar 18, 2022
Thanks for opening your first issue here! Be sure to follow the issue template!
uranusjr commentedon Mar 18, 2022
Good catch. Pull request would be very welcomed!
kianelbo commentedon Apr 3, 2022
Does adding
allow_none=Trueargument to schedule_interval field suffice?If so, may I open the PR?
omarsmak commentedon Apr 3, 2022
I think it doesn't really help, the issue will be on the generated client side.
Feel free to open a PR as I haven't get the time yet
Bowrna commentedon Jun 3, 2022
Currently when I hit the below API
http://127.0.0.1:28080/api/v1/dags/example_trigger_target_dag/details,I get the response:
How does setting the
ScheduleIntervalparam tonullable:truewill be useful?Edit: @uranusjr @omarsmak Could you help me in this?
uranusjr commentedon Jun 6, 2022
From what I understand, the problem is not in the API response, but the generated API clients. The response you have above is currently not consumable by an API client. Adding
nullable: truewould allow the clients to handle"schedule_interval": nullcorrectly. The generated API clients are not a part of the main Airflow repository, but they do rely on theopenapi/v1.ymlfile in here, so we need to fix it for them.