summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/schema/search-config-v2-schema.json
blob: cfd0124fa315773cbd3c01b7069f146f82c1654f (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
{
  "title": "Application Provided Search Engines Schema",
  "description": "This schema contains the details to build application provided search engines shipped in some Mozilla products. The associated remote settings collection is search-config-v2. Note: the top-level properties section is only required to satisfy remoteSettings. The allOf section provides the full details of the different record types.",
  "definitions": {
    "recordType": {
      "title": "Record Type",
      "description": "The type of details that this record contains.",
      "enum": ["engine", "defaultEngines", "engineOrders"]
    },
    "environment": {
      "title": "Environment",
      "description": "Specifies details of possible user environments that the engine or variant applies to",
      "type": "object",
      "properties": {
        "allRegionsAndLocales": {
          "title": "All Regions and Locales",
          "description": "Indicates that this section applies to all regions and locales. May be modified by excludedRegions/excludedLocales.",
          "type": "boolean"
        },
        "regions": {
          "title": "Regions",
          "description": "An array of regions that this section applies to. 'default' will apply to situations where we have not been able to detect the user's region.",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^([a-z][a-z]|default)$",
            "minLength": 2,
            "maxLength": 7
          },
          "uniqueItems": true
        },
        "locales": {
          "title": "Locales",
          "description": "An array of locales that this section applies to. 'default' will apply to situations where we have not been able to detect the user's locale.",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^([a-z]{2,3}(-[a-zA-Z]{2,})?(-macos)?|default)$",
            "minLength": 2
          },
          "uniqueItems": true
        },
        "excludedRegions": {
          "title": "Excluded Regions",
          "description": "An array of regions that this section should be excluded from. 'default' will apply to situations where we have not been able to detect the user's region.",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^([a-z]{2,3}|default)$",
            "minLength": 2,
            "maxLength": 7
          },
          "uniqueItems": true
        },
        "excludedLocales": {
          "title": "Excluded Locales",
          "description": "An array of locales that this section should be excluded from. 'default' will apply to situations where we have not been able to detect the user's locale.",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^([a-z]{2,3}(-[a-zA-Z]{2,})?(-macos)?|default)$",
            "minLength": 2
          },
          "uniqueItems": true
        },
        "distributions": {
          "title": "Distributions",
          "description": "An array of distribution identifiers that this applies to.",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9.-]{0,100}$"
          },
          "uniqueItems": true
        },
        "excludedDistributions": {
          "title": "Excluded Distributions",
          "description": "An array of distribution identifiers that this does not apply to.",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9.-]{0,100}$"
          },
          "uniqueItems": true
        },
        "channels": {
          "title": "Release Channels",
          "description": "An array of release channels that this section applies to (not set = everywhere).",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z]{0,100}$",
            "enum": ["default", "nightly", "aurora", "beta", "release", "esr"]
          },
          "uniqueItems": true
        },
        "experiment": {
          "title": "Experiment",
          "description": "The experiment that this section applies to.",
          "type": "string",
          "pattern": "^[a-zA-Z0-9-]{0,100}$"
        },
        "applications": {
          "title": "Application Identifiers",
          "description": "The application(s) this section applies to (default/not specified is everywhere).",
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z-]{0,100}$",
            "enum": [
              "",
              "firefox",
              "firefox-android",
              "firefox-ios",
              "focus-android",
              "focus-ios"
            ]
          },
          "uniqueItems": true
        },
        "minVersion": {
          "title": "Minimum Version",
          "description": "The minimum application version this section applies to.",
          "type": "string",
          "pattern": "^[0-9a-z.]{0,20}$"
        },
        "maxVersion": {
          "title": "Maximum Version",
          "description": "The maximum application version this section applies to (less-than comparison).",
          "type": "string",
          "pattern": "^[0-9a-z.]{0,20}$"
        }
      }
    },
    "partnerCode": {
      "title": "Partner Code",
      "description": "The partner code for the engine or variant. This will be inserted into parameters which include '{pc}'",
      "type": "string",
      "pattern": "^[a-zA-Z0-9-_]*$"
    },
    "urls": {
      "title": "URLs",
      "description": "The URLs associated with the search engine.",
      "type": "object",
      "properties": {
        "search": {
          "title": "Search URL",
          "description": "The URL to use for searches",
          "$ref": "#/definitions/url"
        },
        "suggestions": {
          "title": "Suggestions URL",
          "description": "The URL to use for suggestions",
          "$ref": "#/definitions/url"
        },
        "trending": {
          "title": "Trending Suggestions URL",
          "description": "The URL to use for tending suggestions",
          "$ref": "#/definitions/url"
        }
      }
    },
    "url": {
      "type": "object",
      "properties": {
        "base": {
          "title": "Base",
          "description": "The PrePath and FilePath of the URL. May include variables for engines which have a variable FilePath, e.g. {searchTerm} for when a search term is within the path of the url.",
          "type": "string"
        },
        "method": {
          "title": "Method",
          "description": "The HTTP method to use to send the request. If not specified, defaults to GET.",
          "type": "string",
          "pattern": "^(GET|POST)$",
          "enum": ["GET", "POST"]
        },
        "params": {
          "title": "Parameters",
          "description": "The parameters for this URL.",
          "type": "array",
          "items": {
            "type": "object",
            "title": "Parameter",
            "properties": {
              "name": {
                "title": "Name",
                "description": "The parameter name",
                "type": "string",
                "pattern": "^[a-zA-Z0-9-_]*$"
              },
              "value": {
                "title": "Value",
                "description": "The parameter value, this may be a static value, or additionally contain a parameter replacement, e.g. {inputEncoding}. For the partner code parameter, this field should be {pc}.",
                "type": "string",
                "pattern": "^[a-zA-Z0-9-_{}]*$"
              },
              "experimentConfig": {
                "title": "Experiment Configuration",
                "description": "The value for the parameter will be derived from the equivalent experiment configuration value. If not experiment is present, this parameter will not be included in the final url.",
                "type": "string",
                "pattern": "^[a-zA-Z0-9-_]*$"
              },
              "searchAccessPoint": {
                "title": "Search Access Point",
                "description": "A parameter whose value depends on the access point where the search was initiated.",
                "type": "object",
                "properties": {
                  "searchbar": {
                    "title": "Name",
                    "description": "The value for the parameter when searched from the search bar.",
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9-_]*$"
                  },
                  "addressbar": {
                    "title": "Name",
                    "description": "The value for the parameter when searched from the address bar.",
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9-_]*$"
                  },
                  "contextmenu": {
                    "title": "Name",
                    "description": "The value for the parameter when searched from the context menu.",
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9-_]*$"
                  },
                  "homepage": {
                    "title": "Name",
                    "description": "The value for the parameter when searched from the homepage.",
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9-_]*$"
                  },
                  "newtab": {
                    "title": "Name",
                    "description": "The value for the parameter when searched from the new tab page.",
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9-_]*$"
                  }
                }
              }
            },
            "oneOf": [
              { "required": ["name", "value"] },
              { "required": ["name", "experimentConfig"] },
              { "required": ["name", "searchAccessPoint"] }
            ]
          }
        },
        "searchTermParamName": {
          "title": "Search Term Parameter Name",
          "description": "The name of the query parameter for the search term. Automatically appended to the end of the query. This may be skipped if `{searchTerm}` is included in the base.",
          "type": "string",
          "pattern": "^[a-zA-Z0-9-_]*$"
        }
      }
    }
  },
  "type": "object",
  "properties": {
    "recordType": { "$ref": "#/definitions/recordType" }
  },
  "allOf": [
    {
      "if": {
        "properties": {
          "recordType": {
            "const": "engine"
          }
        }
      },
      "then": {
        "properties": {
          "recordType": { "$ref": "#/definitions/recordType" },
          "identifier": {
            "title": "Identifier",
            "description": "The identifier of the search engine. This is used as an internal identifier, e.g. for saving the user's settings for the engine. It is also used to form the base telemetry id and may be extended by telemetrySuffix.",
            "type": "string",
            "pattern": "^[a-zA-Z0-9-_]*$"
          },
          "notes": {
            "title": "Notes",
            "description": "A short notes section used to potentially aid identification of this section for humans. Not intended for to be read by the application.",
            "type": "string",
            "pattern": "^[a-zA-Z0-9-_.() ]*$"
          },
          "base": {
            "title": "Base Details",
            "description": "Base details for the engine.",
            "type": "object",
            "properties": {
              "aliases": {
                "title": "Aliases",
                "description": "An array of aliases that the user can use to search with this engine. The aliases will be prefix by '@' on desktop and potentially other platforms.",
                "type": "array",
                "items": {
                  "type": "string",
                  "pattern": "^[a-z\\xa1-\\uffff]*$"
                },
                "uniqueItems": true
              },
              "charset": {
                "title": "Character Set",
                "description": "The character set this engine uses for queries. Defaults to 'UTF=8' if not set.",
                "type": "string",
                "pattern": "^[a-zA-Z0-9-]*$"
              },
              "classification": {
                "title": "Classification",
                "description": "The classification of search engine according to the main search types (e.g. general, shopping, travel, dictionary). Currently, only marking as a general search engine is supported.",
                "type": "string",
                "enum": ["general", "unknown"]
              },
              "name": {
                "title": "Name",
                "description": "The user visible name for the search engine.",
                "type": "string",
                "maxLength": 100
              },
              "partnerCode": {
                "$ref": "#/definitions/partnerCode"
              },
              "urls": {
                "$ref": "#/definitions/urls"
              }
            },
            "required": ["name", "urls", "classification"]
          },
          "variants": {
            "title": "Variants",
            "description": "This section describes variations of this search engine that may occur depending on the user's environment. If multiple sections match a user's environment, then all matching sections are applied cumulatively in the order in the array.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "environment": {
                  "$ref": "#/definitions/environment"
                },
                "partnerCode": {
                  "$ref": "#/definitions/partnerCode"
                },
                "optional": {
                  "title": "Optional",
                  "description": "This search engine is presented as an option that the user may enable. It is not included in the initial list of search engines. If not specified, defaults to false.",
                  "type": "boolean"
                },
                "telemetrySuffix": {
                  "title": "Telemetry Suffix",
                  "description": "Suffix that is appended to the search engine identifier following a dash, i.e. `<identifier>-<suffix>`. There should always be a suffix supplied if the partner code is different.",
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9-]*$"
                },
                "urls": {
                  "$ref": "#/definitions/urls"
                }
              },
              "required": ["environment"],
              "dependencies": {
                "partnerCode": ["telemetrySuffix"]
              }
            }
          }
        },
        "required": ["recordType", "identifier", "base", "variants"]
      }
    },
    {
      "if": {
        "properties": {
          "recordType": {
            "const": "defaultEngines"
          }
        }
      },
      "then": {
        "properties": {
          "recordType": { "$ref": "#/definitions/recordType" },
          "globalDefault": {
            "title": "Global Default",
            "description": "The identifier of the engine that will be used as the application default if no other engines are specified as default.",
            "type": "string",
            "pattern": "^[a-zA-Z0-9-_]*$"
          },
          "globalDefaultPrivate": {
            "title": "Global Default - Private Mode",
            "description": "The identifier of the engine that will be used as the application default in private mode if no other engines are specified as default.",
            "type": "string",
            "pattern": "^[a-zA-Z0-9-_]*$"
          },
          "specificDefaults": {
            "title": "Filters",
            "description": "The specific environment filters to set a different default engine. The array is ordered, when multiple entries match on environments, the later entry will override earlier entries.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "environment": {
                  "$ref": "#/definitions/environment"
                },
                "default": {
                  "title": "Default",
                  "description": "The identifier of the engine that will be used as the application default for the associated environment. If the entry is suffixed with a star, matching is applied on a \"starts with\" basis.",
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9-_]*\\*?$"
                },
                "defaultPrivate": {
                  "title": "Default - Private Mode",
                  "description": "The identifier of the engine that will be used as the application default in private mode for the associated environment. If the entry is suffixed with a star, matching is applied on a \"starts with\" basis.",
                  "type": "string",
                  "pattern": "^[a-zA-Z0-9-_]*\\*?$"
                }
              },
              "oneOf": [
                { "required": ["environment", "default"] },
                { "required": ["environment", "defaultPrivate"] },
                { "required": ["environment", "default", "defaultPrivate"] }
              ]
            }
          }
        },
        "required": ["recordType", "globalDefault"]
      }
    },
    {
      "if": {
        "properties": {
          "recordType": {
            "const": "engineOrders"
          }
        }
      },
      "then": {
        "properties": {
          "recordType": { "$ref": "#/definitions/recordType" },
          "orders": {
            "title": "Orders",
            "description": "When a user's instance matches the defined environments, the associated engine order will be applied. The array is ordered, when multiple entries match on environments, the later entry will override earlier entries.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "environment": {
                  "$ref": "#/definitions/environment"
                },
                "order": {
                  "title": "Engine Order",
                  "type": "array",
                  "description": "The order of the engines for the associated environment. If engines are present for the user but not included in this list, they will follow after the ones in this list in alphabetical order. If an individual entry is suffixed with a star, matching is applied on a \"starts with\" basis.",
                  "items": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9-_]*\\*?$"
                  }
                }
              },
              "required": ["environment"]
            }
          }
        },
        "required": ["recordType", "orders"]
      }
    }
  ]
}