Permalink
Browse files

Pretty print saved service document

  • Loading branch information...
1 parent ba5c97a commit aa9de687cac3d5a34bfe014c442b271c919bf199 @astrada committed Dec 3, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 tools/serviceGenerator.ml
@@ -67,8 +67,14 @@ let get_service_description api version nocache =
let () = print_endline "Done" in
let tree = RestDescription.to_data_model document in
let json = GapiJson.data_model_to_json tree in
- let () = Yojson.Safe.to_file file_name json in
- document
+ let ch = open_out file_name in
+ try
+ Yojson.Safe.pretty_to_channel ch json;
+ close_out ch;
+ document
+ with e ->
+ close_out ch;
+ raise e
end else begin
Printf.printf "Reusing %s %s service description file %s\n%!"
api version file_name;

0 comments on commit aa9de68

Please sign in to comment.