data-api-builder icon indicating copy to clipboard operation
data-api-builder copied to clipboard

[Bug]: OpenAPI and $filter for dates

Open verschaevesiebe opened this issue 5 months ago • 5 comments

What happened?

Hi Team,

We've developed a custom frontend and backend solution to manage API creation on our API Management platform, utilizing Data API Builder (DAB) to select fields and apply dynamic and fixed filters to APIs.

The issue arises with certain MSSQL tables using the datetime(2) data type. In the OpenAPI specification generated by DAB, these columns are represented as string types without a specified format.

OpenAPI exposed by DAB Image

For exposure through REST we don't have issues, but there's now a requirement to add filters based on those dates. The data within the database looks like a normal date (not ISO8601 compliant) and is exposed through DAB rest endpoint as follows:

Image

According to the documentation, date values should not be enclosed in quotes. However, when dynamically constructing the $filter parameter for DAB, we currently lack a method to distinguish whether a field is a true string or a date field.

Image

One proposed solution was to omit quotes for non-eq comparisons, but this approach fails when an exact date match is required.

Any insights or suggestions to address this issue would be appreciated.

Best Regards, Siebe

Version

1.3.19

What database are you using?

Azure SQL

What hosting model are you using?

Container Apps

Which API approach are you accessing DAB through?

REST

Relevant log output


Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

verschaevesiebe avatar Jul 23 '25 12:07 verschaevesiebe

+1

wundefined avatar Jul 23 '25 12:07 wundefined

Related: #2276

JerryNixon avatar Jul 29 '25 22:07 JerryNixon

+1

ClaudioG64 avatar Aug 19 '25 13:08 ClaudioG64

+1

Also, when looking at the OpenAPI documentation it clearly states the 'format" property values should be included.

Image

As opposed to what currently is being returned:

Image

As the underlaying data source is successfully configured (see image below), it might be easy enough to - when fetching the metdata/schematics - adhere to the documentation of OpenAPI when generating the spec?

Image

Michael-bracke-delaware avatar Sep 08 '25 13:09 Michael-bracke-delaware

This is part of a bigger effort to address several inadequacies in the OpenAPI document we generate.

JerryNixon avatar Nov 03 '25 06:11 JerryNixon