question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ScheduleInterval schema in OpenAPI specs should have "nullable: true" otherwise generated OpenAPI client will throw an error in case of nullable "schedule_interval"

See original GitHub issue

Apache Airflow version

2.2.4 (latest released)

What happened

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 None schedule_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 😃

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
uranusjrcommented, 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: 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.

1reaction
uranusjrcommented, Mar 18, 2022

Good catch. Pull request would be very welcomed!

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAPI Specification - Version 3.0.3 - Swagger
The OpenAPI Specification defines a standard interface to RESTful APIs which allows both humans and computers to understand service capabilities without ...
Read more >
Getting Started | DataHub
The OpenAPI UI includes explorable schemas for request and response objects that are fully documented. The models used in the OpenAPI UI are...
Read more >
Using OpenAPI and Swagger UI - Quarkus
This guide explains how your Quarkus application can expose its API description through an OpenAPI specification and how you can test it via...
Read more >
Documentation for the java-camel Generator
Generate an OpenAPI 3 specification using SpringDoc. springdoc. ensureUniqueParams, Whether to ensure parameter names are unique in an operation ...
Read more >
Open API Server Implementation Using OpenAPI Generator
Learn how to generate a Spring-based server stub from a YAML specification using the OpenAPI generator's Maven plugin.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found