robertwb commented on code in PR #29080:
URL: https://github.com/apache/beam/pull/29080#discussion_r1367211850


##########
sdks/python/apache_beam/yaml/json_utils.py:
##########
@@ -131,15 +134,47 @@ def json_to_row(beam_type: schema_pb2.FieldType) -> 
Callable[[Any], Any]:
     raise ValueError(f"Unrecognized type_info: {type_info!r}")
 
 
-def json_parser(beam_schema: schema_pb2.Schema) -> Callable[[bytes], beam.Row]:
+def json_parser(
+    beam_schema: schema_pb2.Schema,
+    json_schema: Optional[Dict[str,
+                               Any]] = None) -> Callable[[bytes], beam.Row]:
   """Returns a callable converting Json strings to Beam rows of the given type.
 
   The input to the returned callable is expected to conform to the Json schema
   corresponding to this Beam type.
   """
+  if json_schema is None:
+    validate_fn = None
+  else:
+    cls = jsonschema.validators.validator_for(json_schema)

Review Comment:
   Yes, that's what check_schema below does. 



-- 
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]

Reply via email to