OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

testDefinitions API: entityType query param is case-sensitive, frontend sends mixed case → 0 results for non-admin users

Open joyfulwang opened this issue 5 months ago • 2 comments

Affected module

UI

Describe the bug

Description

The /api/v1/dataQuality/testDefinitions endpoint's entityType query parameter is case-sensitive. The frontend sends entityType=Column (mixed case, from the TypeScript EntityType.Column enum), but the backend only matches uppercase COLUMN. This causes 0 results to be returned for non-admin users when they try to add a column-level test, while admin users bypass the issue because isAdmin() short-circuits authorization.

This manifests for end users in the following way:

  1. User has permission to configure DQ checks for a table
  2. User tries to configure DQ check and can select "Table-level" or "Column-level" test
  3. User tries to make "Column-level" test and selects the column that they want the test to run again
  4. Test types dropdown is empty and says "No data", instead of showing options like "Column value not null", etc.

Root Cause

The frontend (TestCaseFormV1.tsx) sends:

entityType: selectedTestLevel === TestLevel.COLUMN ? EntityType.Column : EntityType.Table\

Where EntityType.Column resolves to the string "Column" (mixed case).

The backend's query parameter parsing for entityType appears to do a case-sensitive enum match against "COLUMN" / "TABLE" (Java enum uppercase convention), so "Column" doesn't match and is treated as "no filter" or returns empty.

Relevant Code

  • Frontend: openmetadata-ui/src/main/resources/ui/src/components/DataQuality/AddDataQualityTest/components/TestCaseFormV1.tsx — fetchTestDefinitions function
  • Backend: openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestDefinitionResource.java — list endpoint query param parsing

Workaround

Granting testDefinition: All (instead of testDefinition: ViewAll) to the user's policy makes column-level test types appear. The exact mechanism by which All bypasses the broken filter is unclear but confirmed through testing.

To Reproduce

Steps to Reproduce

  1. Create a non-admin user with testDefinition: ViewAll permission
  2. Navigate to a table → Data Quality → Add Test Case → select Column level → select a column
  3. The "Test Type" dropdown shows "No data"

API Evidence

Mixed case (what frontend sends) → 0 results

GET /api/v1/dataQuality/testDefinitions?entityType=Column&testPlatform=OpenMetadata → {"data": [], "paging": {"total": 0}}

Uppercase → works correctly (16 results)

GET /api/v1/dataQuality/testDefinitions?entityType=COLUMN&testPlatform=OpenMetadata → {"data": [...], "paging": {"total": 16}}

testDefinitionType param (different name) → also works

GET /api/v1/dataQuality/testDefinitions?testDefinitionType=Column&testPlatform=OpenMetadata → {"data": [...], "paging": {"total": 25}}

This returns 0 even as an admin user when calling the API directly. However, admin users still see results in the UI because the DefaultAuthorizer.isAdmin() check appears to bypass the filtering logic that produces 0 results for non-admin users.

Expected behavior

The entityType query parameter should be case-insensitive, or the frontend should send the value in the case the backend expects.

Users without admin access and with fine-grained permissions for creating DQ checks should be able to see column-level test options when creating DQ tests

OS

No response

Python version

No response

OpenMetadata version

1.12.6

OpenMetadata Ingestion package version

No response

Additional context

No response

Pre-submission checklist

  • [x] I searched for duplicate issues.
  • [x] I removed credentials, hostnames, emails, and other sensitive data from logs and config.

joyfulwang avatar Jun 26 '26 22:06 joyfulwang

I'd like to work on this issue, if possible of course!

Al-Zaytoun avatar Jun 29 '26 00:06 Al-Zaytoun

Hey, im wondering if a maintainer could provide some closure to this pr? Am i to assume that my work is done, or is there something I'm missing? the last CLI message's are kind of misleading. Thanks!

Al-Zaytoun avatar Aug 26 '26 01:08 Al-Zaytoun