vss_24.0.0_b4d0be7c/tools/json_schema/json_schema-readers.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--
--  Copyright (C) 2022, AdaCore
--
--  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--

with Ada.Containers.Hashed_Maps;
with VSS.JSON.Pull_Readers;
with VSS.Strings.Hash;

package JSON_Schema.Readers is

   type Schema_Version is (Draft_4, Draft_6, Draft_7);

   package Schema_Maps is new Ada.Containers.Hashed_Maps
     (VSS.Strings.Virtual_String,
      Schema_Access,
      VSS.Strings.Hash,
      VSS.Strings."=");

   type Schema_Map is new Schema_Maps.Map with null record;

   procedure Read
     (Reader  : in out VSS.JSON.Pull_Readers.JSON_Pull_Reader'Class;
      Schema  : out Schema_Access;
      Other   : out Schema_Map;
      Version : Schema_Version := Schema_Version'Last);
   --  Parse JSON using given Reader and fill a Schema object. Put sub-schemas
   --  into the Other name-to-schema map.

end JSON_Schema.Readers;