im-Toqeer-506 commented on issue #37575: URL: https://github.com/apache/beam/issues/37575#issuecomment-3889616367
Hi @atheendre130505 The _validate_compatible() function in sdks/python/apache_beam/yaml/json_utils.py contains a logic error that prevents object schema validation from executing. The condition `elif weak_schema == 'object'` incorrectly compares a dictionary to a string, which always evaluates to False. As a result, object-level validation is skipped entirely. This allows incompatible Beam and JSON schemas to pass validation silently. Type mismatches are therefore not detected during pipeline construction. Instead, errors surface later at runtime, making debugging difficult. The fix changes the condition to `weak_schema['type'] == 'object'` so validation executes correctly. Minor related issues (error formatting and dict iteration) are also corrected. After the fix, incompatible schemas correctly raise `ValueError` while compatible schemas continue to pass. I would like to submit a PR implementing this correction and adding unit tests. Please assign me this -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
