package crs

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file diagnostic_result.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(****************************************************************************)
(*  ocaml-reviewdog - A reviewdog diagnostics json serializer for OCaml     *)
(*  SPDX-FileCopyrightText: 2025 Mathieu Barbin <mathieu.barbin@gmail.com>  *)
(*  SPDX-License-Identifier: MIT                                            *)
(****************************************************************************)

type t =
  { source : Source.t option
  ; severity : Severity.t option
  ; diagnostics : Diagnostic.t list
  }

let to_json { source; severity; diagnostics } : Yojson.Basic.t =
  `Assoc
    (List.concat
       [ [ "diagnostics", `List (List.map Diagnostic.to_json diagnostics) ]
       ; (match source with
          | None -> []
          | Some s -> [ "source", Source.to_json s ])
       ; (match severity with
          | None -> []
          | Some s -> [ "severity", Severity.to_json s ])
       ])
;;