templates.schema.json 3.96 KB
Newer Older
Diegodlh's avatar
Diegodlh committed
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://gitlab.wikimedia.org/diegodlh/w2c-core/-/blob/main/templates.schema.json",
  "title": "Translation templates",
  "description": "Domain translation templates configuration for Web2Cit",
  "type": "object",
  "properties": {
    "templates": {
      "description": "A list of translation templates",
      "type": "array",
      "items": {
        "description": "A translation template",
        "type": "object",
        "properties": {
          "path": {
            "description": "Path of the webpage used as translation template",
            "type": "string"
          },
          "label": {
            "description": "Fancy name for this translation template",
            "type": "string"
          },
          "fields": {
            "description": "A list of template fields",
            "type": "array",
            "items": {
              "description": "A template field",
              "type": "object",
              "properties": {
                "fieldname": {
                  "description": "Name of the template field",
                  "type": "string"
                },
                "required": {
                  "description": "whether the template field is required",
                  "type": "boolean"
                },
                "procedures": {
                  "description": "A list of translation procedures",
                  "type": "array",
                  "items": {
                    "description": "A translation procedure",
                    "type": "object",
                    "properties": {
                      "selections": {
                        "description": "A list of selection steps",
                        "type": "array",
                        "items": {
                          "description": "A selection step",
                          "type": "object",
                          "properties": {
                            "type": {
                              "description": "The specific type of selection step",
                              "type": "string"
                            },
                            "config": {
                              "description": "the specific configuration for the selection step",
                              "type": "string"
                            }
                          },
                          "required": ["type", "config"]
                        }
                      },
                      "transformations": {
                        "description": "A list of transformation steps",
                        "type": "array",
                        "items": {
                          "description": "A transformation step",
                          "type": "object",
                          "properties": {
                            "type": {
                              "description": "The specific type of transformation step",
                              "type": "string"
                            },
                            "config": {
                              "description": "The specific configuration for the transformation step",
                              "type": "string"
                            },
                            "itemwise": {
                              "description": "Apply transformation to each item of the input independently (true), or to the entire input as a whole (false)",
                              "type": "boolean"
                            }
                          },
                          "required": ["type", "config", "itemwise"]
                        }
                      }
                    },
                    "required": ["selections", "transformations"]
                  }
                }
              },
              "required": ["fieldname", "required", "procedures"]
            }
          }
        },
        "required": ["path", "fields"]
      }
    }
  },
  "required": ["templates"]
}