@@ -265,11 +265,13 @@ def main(argsl: Optional[List[str]] = None) -> int:
265265
266266 # Optionally print the schema after ref resolution
267267 if not args .document and args .print_pre :
268- json_dump (schema_doc , fp = sys .stdout , indent = 4 )
268+ json_dump (schema_doc , fp = sys .stdout , indent = 4 , default = str )
269269 return 0
270270
271271 if not args .document and args .print_index :
272- json_dump (list (metaschema_loader .idx .keys ()), fp = sys .stdout , indent = 4 )
272+ json_dump (
273+ list (metaschema_loader .idx .keys ()), fp = sys .stdout , indent = 4 , default = str
274+ )
273275 return 0
274276
275277 # Validate the schema document against the metaschema
@@ -322,21 +324,21 @@ def main(argsl: Optional[List[str]] = None) -> int:
322324 exc_info = ((type (err ), err , None ) if args .debug else None ),
323325 )
324326 if args .print_avro :
325- json_dump (avsc_obj , fp = sys .stdout , indent = 4 )
327+ json_dump (avsc_obj , fp = sys .stdout , indent = 4 , default = str )
326328 return 1
327329 else :
328330 _logger .error ("Schema `%s` must be a list." , args .schema )
329331 return 1
330332
331333 # Optionally print Avro-compatible schema from schema
332334 if args .print_avro :
333- json_dump (avsc_obj , fp = sys .stdout , indent = 4 )
335+ json_dump (avsc_obj , fp = sys .stdout , indent = 4 , default = str )
334336 return 0
335337
336338 # Optionally print the json-ld context from the schema
337339 if args .print_jsonld_context :
338340 j = {"@context" : schema_ctx }
339- json_dump (j , fp = sys .stdout , indent = 4 , sort_keys = True )
341+ json_dump (j , fp = sys .stdout , indent = 4 , sort_keys = True , default = str )
340342 return 0
341343
342344 # Optionally print the RDFS graph from the schema
@@ -345,7 +347,7 @@ def main(argsl: Optional[List[str]] = None) -> int:
345347 return 0
346348
347349 if args .print_metadata and not args .document :
348- json_dump (schema_metadata , fp = sys .stdout , indent = 4 )
350+ json_dump (schema_metadata , fp = sys .stdout , indent = 4 , default = str )
349351 return 0
350352
351353 if args .print_inheritance_dot :
@@ -379,11 +381,13 @@ def main(argsl: Optional[List[str]] = None) -> int:
379381
380382 # Optionally print the document after ref resolution
381383 if args .print_pre :
382- json_dump (document , fp = sys .stdout , indent = 4 )
384+ json_dump (document , fp = sys .stdout , indent = 4 , default = str )
383385 return 0
384386
385387 if args .print_index :
386- json_dump (list (document_loader .idx .keys ()), fp = sys .stdout , indent = 4 )
388+ json_dump (
389+ list (document_loader .idx .keys ()), fp = sys .stdout , indent = 4 , default = str
390+ )
387391 return 0
388392
389393 # Validate the user document against the schema
@@ -410,7 +414,7 @@ def main(argsl: Optional[List[str]] = None) -> int:
410414 return 1
411415
412416 if args .print_metadata :
413- json_dump (doc_metadata , fp = sys .stdout , indent = 4 )
417+ json_dump (doc_metadata , fp = sys .stdout , indent = 4 , default = str )
414418 return 0
415419
416420 print (f"Document `{ args .document } ` is valid" )
0 commit comments