mransan/ocaml-protoc

"Type annotation" not implemented for yojson

Closed this issue · 1 comments

_pb.ml files generated code like

  match Pbrt.Decoder.int_as_varint d with
  | 0 -> (Mesos_types.Unknown:Mesos_types.framework_info_capability_type)
  | 1 -> (Mesos_types.Revocable_resources:Mesos_types.framework_info_capability_type)
  | 2 -> (Mesos_types.Task_killing_state:Mesos_types.framework_info_capability_type)
  | 3 -> (Mesos_types.Gpu_resources:Mesos_types.framework_info_capability_type)
  | 4 -> (Mesos_types.Shared_resources:Mesos_types.framework_info_capability_type)
  | 5 -> (Mesos_types.Partition_aware:Mesos_types.framework_info_capability_type)
  | 6 -> (Mesos_types.Multi_role:Mesos_types.framework_info_capability_type)
  | 7 -> (Mesos_types.Reservation_refinement:Mesos_types.framework_info_capability_type)
  | _ -> Pbrt.Decoder.malformed_variant "framework_info_capability_type"

but _yojson.ml files have something like

  match json with
  | `String "UNKNOWN" -> Mesos_types.Unknown
  | `String "REVOCABLE_RESOURCES" -> Mesos_types.Revocable_resources
  | `String "TASK_KILLING_STATE" -> Mesos_types.Task_killing_state
  | `String "GPU_RESOURCES" -> Mesos_types.Gpu_resources
  | `String "SHARED_RESOURCES" -> Mesos_types.Shared_resources
  | `String "PARTITION_AWARE" -> Mesos_types.Partition_aware
  | `String "MULTI_ROLE" -> Mesos_types.Multi_role
  | `String "RESERVATION_REFINEMENT" -> Mesos_types.Reservation_refinement
  | _ -> Pbrt_yojson.E.malformed_variant "framework_info_capability_type"

This leads to compilation errors in the yojson .ml.

Fixed.