datahub icon indicating copy to clipboard operation
datahub copied to clipboard

fix(ingestion/extractor): accept bool type in json-schema extractor

Open btkcodedev opened this issue 4 weeks ago • 4 comments

closes #15421

Fix for Boolean Schema Properties in JSON Schema Ingestion

What: Fixed TypeError: argument of type 'bool' is not iterable when JSON schema properties are set to boolean values.

Root cause

Methods expected Dict but received bool when properties were set to true/false per JSON Schema spec.

Code Analysis

Main file: metadata-ingestion/src/datahub/ingestion/extractor/json_schema_util.py -> Code expected all schemas to be Dict objects -> Crashed at Ellipsis in schema and "key" in schema checks when schema was boolean -> Boolean schemas are valid per JSON Schema: true = accepts any JSON, false = never validates

Solution

-> Added isinstance(schema, bool) checks before Ellipsis in schema -> Convert boolean → {} dict at property iteration

This PR prevents crashes throughout the call chain for bool type

btkcodedev avatar Nov 28 '25 03:11 btkcodedev

Unit test results: image

btkcodedev avatar Nov 28 '25 03:11 btkcodedev

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: All tests successful. No failed tests found.

:loudspeaker: Thoughts on this report? Let us know!

codecov[bot] avatar Nov 28 '25 04:11 codecov[bot]

Bundle Report

Bundle size has no change :white_check_mark:

codecov[bot] avatar Nov 28 '25 11:11 codecov[bot]

@btkcodedev Thanks for the contribution

deepgarg760 avatar Dec 02 '25 11:12 deepgarg760

@btkcodedev , Please take care of the comment from @sgomezvillamor

deepgarg760 avatar Dec 17 '25 09:12 deepgarg760