diff options
Diffstat (limited to 'toolkit/components/search/schema')
11 files changed, 1114 insertions, 0 deletions
diff --git a/toolkit/components/search/schema/Readme.txt b/toolkit/components/search/schema/Readme.txt new file mode 100644 index 0000000000..14fffb5c10 --- /dev/null +++ b/toolkit/components/search/schema/Readme.txt @@ -0,0 +1,7 @@ +The schemas in this directory are the primary source for the schemas they represent. + +They are uploaded to the RemoteSettings server to validate new configurations. + +Any changes should be validated by the Search team. + +See the documentation for more information: https://firefox-source-docs.mozilla.org/ diff --git a/toolkit/components/search/schema/search-config-icons-schema.json b/toolkit/components/search/schema/search-config-icons-schema.json new file mode 100644 index 0000000000..eda23080dd --- /dev/null +++ b/toolkit/components/search/schema/search-config-icons-schema.json @@ -0,0 +1,28 @@ +{ + "title": "Search Engine Icons Schema", + "description": "This schema contains the structure of data for search engine icons which built from search-config-v2. The associated remote settings collection is search-config-icons.", + "type": "object", + "required": ["engineIdentifiers", "imageSize"], + "properties": { + "engineIdentifiers": { + "title": "Engine Identifiers", + "description": "An array of search engine identifiers that the attached icon is for. If an individual entry is suffixed with a star, matching is applied on a \"starts with\" basis.", + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-zA-Z0-9-_]*\\*?$" + } + }, + "imageSize": { + "title": "Image Size", + "description": "The image size in pixels. May be used to choose the most appropriate image for the display.", + "type": "number" + }, + "filter_expression": { + "type": "string", + "title": "Filter Expression", + "description": "A JEXL to filter records", + "pattern": "^[a-zA-Z0-9-_=!\"{} .]*$" + } + } +} diff --git a/toolkit/components/search/schema/search-config-icons-ui-schema.json b/toolkit/components/search/schema/search-config-icons-ui-schema.json new file mode 100644 index 0000000000..7757d699a0 --- /dev/null +++ b/toolkit/components/search/schema/search-config-icons-ui-schema.json @@ -0,0 +1,3 @@ +{ + "ui:order": ["engineIdentifiers", "imageSize", "filter_expression"] +} diff --git a/toolkit/components/search/schema/search-config-overrides-schema.json b/toolkit/components/search/schema/search-config-overrides-schema.json new file mode 100644 index 0000000000..784c059a81 --- /dev/null +++ b/toolkit/components/search/schema/search-config-overrides-schema.json @@ -0,0 +1,64 @@ +{ + "title": "Search Engine Overrides Schema", + "description": "This schema contains the details for overriding application provided search engines defined in search-config. The associated remote settings collection is search-config-overrides.", + "type": "object", + "required": ["telemetryId"], + "properties": { + "telemetryId": { + "type": "string", + "title": "Telemetry Id", + "description": "The telemetry Id used to match the engine that this record will override.", + "pattern": "^[a-zA-Z0-9-$_]{0,100}$" + }, + "params": { + "$ref": "#/definitions/params" + }, + "clickUrl": { + "type": "string", + "format": "uri", + "description": "The url used to for reporting clicks." + }, + "telemetrySuffix": { + "type": "string", + "title": "Telemetry Suffix", + "description": "Suffix that is appended to the search engine identifier following a dash, i.e. `<identifier>-<suffix>`.", + "pattern": "^[a-zA-Z0-9-]*$" + } + }, + "definitions": { + "searchUrlCodes": { + "type": "array", + "title": "Codes", + "description": "A array of objects - map of parameter name to the parameter value.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Name", + "pattern": "^[a-zA-Z0-9.-]{0,100}$", + "description": "Name of the parameter that will be used in the query" + }, + "value": { + "type": "string", + "title": "Value", + "pattern": "^[a-zA-Z0-9_{}:/.-]{0,100}$", + "description": "The value of parameter (pref or purpose)" + } + } + } + }, + "params": { + "type": "object", + "title": "Parameters", + "description": "Various parameters for the search engines", + "properties": { + "searchUrlGetParams": { + "title": "Search URL GET Parameters", + "description": "Extra parameters for search URLs (e.g. 'pc=foo').", + "$ref": "#/definitions/searchUrlCodes" + } + } + } + } +} diff --git a/toolkit/components/search/schema/search-config-overrides-v2-schema.json b/toolkit/components/search/schema/search-config-overrides-v2-schema.json new file mode 100644 index 0000000000..cac02d8f2a --- /dev/null +++ b/toolkit/components/search/schema/search-config-overrides-v2-schema.json @@ -0,0 +1,84 @@ +{ + "title": "Search Engine Overrides Schema", + "description": "This schema contains the details for overriding application provided search engines defined in search-config-v2. The associated remote settings collection is search-config-overrides-v2.", + "definitions": { + "partnerCode": { + "title": "Partner Code", + "description": "The partner code for the engine or variant. This will be inserted into parameters which include '{partnerCode}'", + "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" + } + } + }, + "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" + }, + "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-_{}]*$" + } + }, + "required": ["name", "value"] + } + } + } + } + }, + "type": "object", + "properties": { + "identifier": { + "title": "Identifier", + "description": "This is the identifier of the search engine in search-config-v2 that this record will override. It may be extended by telemetrySuffix.", + "type": "string", + "pattern": "^[a-zA-Z0-9-_]*$" + }, + "partnerCode": { + "$ref": "#/definitions/partnerCode" + }, + "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-]*$" + }, + "clickUrl": { + "type": "string", + "format": "uri", + "description": "The url used to for reporting clicks." + }, + "urls": { + "$ref": "#/definitions/urls" + } + } +} diff --git a/toolkit/components/search/schema/search-config-schema.json b/toolkit/components/search/schema/search-config-schema.json new file mode 100644 index 0000000000..c902044b85 --- /dev/null +++ b/toolkit/components/search/schema/search-config-schema.json @@ -0,0 +1,392 @@ +{ + "type": "object", + "required": ["webExtension"], + "properties": { + "default": { + "$ref": "#/definitions/default" + }, + "defaultPrivate": { + "$ref": "#/definitions/defaultPrivate" + }, + "orderHint": { + "$ref": "#/definitions/orderHint" + }, + "appliesTo": { + "type": "array", + "title": "Applies To", + "description": "This section defines the region/locales/application information for where a search engine is available, and any specifics for that region/locale/application. If there are no entries in the list, it is considered to be included everywhere", + "items": { + "$ref": "#/definitions/appliesToSection" + } + }, + "telemetryId": { + "type": "string", + "title": "Telemetry Id", + "description": "The telemetry Id as used for search telemetry." + }, + "webExtension": { + "$ref": "#/definitions/webExtension" + }, + "urls": { + "$ref": "#/definitions/urls" + }, + "params": { + "$ref": "#/definitions/params" + }, + "extraParams": { + "$ref": "#/definitions/extraParams" + }, + "suggestExtraParams": { + "$ref": "#/definitions/extraParams" + } + }, + "definitions": { + "application": { + "type": "object", + "title": "Application Details", + "properties": { + "name": { + "type": "array", + "title": "Name", + "description": "The application(s) this applies to (default/not specified is everywhere)", + "items": { + "type": "string", + "pattern": "^[a-z]{0,100}$", + "enum": ["", "firefox"] + }, + "uniqueItems": true + }, + "channel": { + "type": "array", + "title": "Channel", + "description": "Which channel this belongs to (not set = everywhere). For ESR this is also keyed from the display version.", + "items": { + "type": "string", + "pattern": "^[a-z]{0,100}$", + "enum": ["default", "nightly", "aurora", "beta", "release", "esr"] + }, + "uniqueItems": true + }, + "distributions": { + "type": "array", + "title": "Distributions", + "description": "Which distributions this applies to.", + "items": { + "type": "string", + "pattern": "^[a-zA-Z0-9.-]{0,100}$" + }, + "uniqueItems": true + }, + "excludedDistributions": { + "type": "array", + "title": "Excluded Distributions", + "description": "Which distributions this does not apply to.", + "items": { + "type": "string", + "pattern": "^[a-zA-Z0-9.-]{0,100}$" + }, + "uniqueItems": true + }, + "minVersion": { + "type": "string", + "title": "Minimum Version", + "pattern": "^[0-9a-z.]{0,20}$", + "description": "The minimum version this applies to" + }, + "maxVersion": { + "type": "string", + "title": "Maximum Version", + "pattern": "^[0-9a-z.]{0,20}$", + "description": "The maximum version this applies to (less-than comparison)" + } + } + }, + "default": { + "type": "string", + "title": "Default Status", + "pattern": "^[a-z-]{0,20}$", + "description": "Whether or not this engine should be default.", + "enum": ["yes", "yes-if-no-other", "no"] + }, + "defaultPrivate": { + "type": "string", + "title": "Default Status (PBM)", + "pattern": "^[a-z-]{0,20}$", + "description": "Whether or not this engine should be default in private browsing mode.", + "enum": ["yes", "yes-if-no-other", "no"] + }, + "extraParams": { + "type": "array", + "title": "Extra Parameters", + "description": "Extra parameters for the search engine (aka MozParams)", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Name", + "pattern": "^[a-z]{0,20}$", + "description": "Name of the parameter that will be used in the search query" + }, + "condition": { + "type": "string", + "title": "Condition", + "pattern": "^[a-z]{0,10}$", + "description": "The type of parameter (pref or purpose)", + "enum": ["pref", "purpose"] + }, + "purpose": { + "type": "string", + "title": "Purpose", + "pattern": "^[a-z{}]{0,100}$", + "description": "The search purpose that triggers this parameter being appended.", + "enum": [ + "searchbar", + "keyword", + "contextmenu", + "homepage", + "newtab" + ] + }, + "value": { + "type": "string", + "title": "Value", + "pattern": "^[a-zA-Z0-9_]{0,100}$", + "description": "If this is a purpose type, the value is used as the value of the parameter in the query" + }, + "pref": { + "type": "string", + "title": "Preference name", + "pattern": "^[a-z0-9_]{0,100}$", + "description": "The preference name to get the value from (i.e. browser.search.param.<preference name>)." + } + } + } + }, + "orderHint": { + "type": "number", + "title": "Order Hint", + "description": "A hint to the display order (higher is a higher rank)" + }, + "searchUrlCodes": { + "type": "array", + "title": "Codes", + "description": "A array of objects - map of parameter name to the parameter value.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Name", + "pattern": "^[a-zA-Z0-9.-]{0,100}$", + "description": "Name of the parameter that will be used in the query" + }, + "value": { + "type": "string", + "title": "Value", + "pattern": "^[a-zA-Z0-9_{}:/.-]{0,100}$", + "description": "The value of parameter (pref or purpose)" + } + } + } + }, + "params": { + "type": "object", + "title": "Parameters", + "description": "Various parameters for the search engines", + "properties": { + "searchUrlGetParams": { + "title": "Search URL GET Parameters", + "description": "Extra parameters for search URLs (e.g. 'pc=foo').", + "$ref": "#/definitions/searchUrlCodes" + }, + "suggestUrlGetParams": { + "title": "Suggestion URL GET Parameters", + "description": "Extra parameters for search suggestion URLs (e.g. 'pc=foo').", + "$ref": "#/definitions/searchUrlCodes" + }, + "searchUrlPostParams": { + "title": "Search URL POST Parameters", + "description": "Extra parameters for search URLs (e.g. 'pc=foo').", + "$ref": "#/definitions/searchUrlCodes" + }, + "suggestUrlPostParams": { + "title": "Suggestion URL POST Parameters", + "description": "Extra parameters for search suggestion URLs (e.g. 'pc=foo').", + "$ref": "#/definitions/searchUrlCodes" + } + } + }, + "telemetryId": { + "type": "string", + "title": "Telemetry Id", + "pattern": "^[a-zA-Z0-9-$_]{0,100}$", + "description": "The telemetry Id as used for search telemetry." + }, + "webExtension": { + "type": "object", + "title": "WebExtension", + "properties": { + "id": { + "type": "string", + "title": "WebExtension Id", + "description": "The identifier (local part) of the associated WebExtension should be of the format example@search.mozilla.org", + "pattern": "^[a-zA-Z0-9-._]*@search.mozilla.org$" + }, + "locales": { + "type": "array", + "title": "WebExtension Locales", + "description": "Overrides the WebExtension locales and specifies to use a particular one. Ideally this should only be used when really necessary, otherwise considered deprecated.", + "items": { + "type": "string", + "pattern": "^[a-zA-Z0-9-$_]{0,100}$" + } + } + } + }, + "urls": { + "type": "object", + "description": "Urls pertaining to this engine", + "properties": { + "trending": { + "type": "object", + "description": "Details of the url used to fetch trending suggestions", + "properties": { + "fullPath": { + "type": "string", + "title": "fullPath", + "format": "uri", + "description": "The url used to retrieve trending suggestions" + }, + "query": { + "type": "string", + "title": "query", + "description": "The query parameters to send in a trending suggestions request", + "pattern": "^[a-zA-Z0-9.={}&-]{0,100}$" + } + } + } + } + }, + "regionDetails": { + "type": "array", + "title": "Regions", + "description": "Two-letter region codes.", + "items": { + "type": "string", + "pattern": "^([a-z][a-z]|default)$", + "minLength": 2, + "maxLength": 7 + } + }, + "localeDetails": { + "type": "object", + "title": "Locales", + "description": "Locale codes.", + "properties": { + "matches": { + "type": "array", + "title": "Matches exactly the codes", + "items": { + "type": "string", + "pattern": "^([a-z]{2,3}(-[a-zA-Z]{2,})?(-macos)?|default)$", + "minLength": 2 + } + }, + "startsWith": { + "type": "array", + "title": "Matches any code starting with", + "items": { + "type": "string", + "pattern": "^[a-z]{2,3}$", + "minLength": 2, + "maxLength": 3 + } + } + } + }, + "included": { + "type": "object", + "title": "Included Locations", + "description": "The locations to which this section applies. Note: Regions and Locales are 'and'ed together.", + "properties": { + "everywhere": { + "type": "boolean", + "title": "Everywhere", + "description": "Set to true to signify that this is included everywhere." + }, + "regions": { + "$ref": "#/definitions/regionDetails" + }, + "locales": { + "$ref": "#/definitions/localeDetails" + } + } + }, + "excluded": { + "type": "object", + "title": "Excluded Locations", + "description": "The locations to which this section applies. Note: Regions and Locales are 'and'ed together.", + "properties": { + "regions": { + "$ref": "#/definitions/regionDetails" + }, + "locales": { + "$ref": "#/definitions/localeDetails" + } + } + }, + "appliesToSection": { + "type": "object", + "properties": { + "default": { + "$ref": "#/definitions/default" + }, + "defaultPrivate": { + "$ref": "#/definitions/defaultPrivate" + }, + "orderHint": { + "$ref": "#/definitions/orderHint" + }, + "included": { + "$ref": "#/definitions/included" + }, + "excluded": { + "$ref": "#/definitions/excluded" + }, + "application": { + "$ref": "#/definitions/application" + }, + "webExtension": { + "$ref": "#/definitions/webExtension" + }, + "urls": { + "$ref": "#/definitions/urls" + }, + "telemetryId": { + "$ref": "#/definitions/telemetryId" + }, + "params": { + "$ref": "#/definitions/params" + }, + "extraParams": { + "$ref": "#/definitions/extraParams" + }, + "experiment": { + "type": "string", + "title": "Experiment", + "pattern": "^[a-zA-Z0-9-]{0,100}$", + "description": "The experiment this section is associated with, if blank it is associated with any configuration." + }, + "override": { + "type": "boolean", + "title": "Override", + "description": "This section will override previous appliesTo sections, but not add new locations where this engine is deployed to." + }, + "suggestExtraParams": { + "$ref": "#/definitions/extraParams" + } + } + } + } +} diff --git a/toolkit/components/search/schema/search-config-ui-schema.json b/toolkit/components/search/schema/search-config-ui-schema.json new file mode 100644 index 0000000000..5b36e5e6ee --- /dev/null +++ b/toolkit/components/search/schema/search-config-ui-schema.json @@ -0,0 +1,14 @@ +{ + "ui:order": [ + "webExtension", + "default", + "defaultPrivate", + "orderHint", + "telemetryId", + "urls", + "params", + "extraParams", + "suggestExtraParams", + "appliesTo" + ] +} diff --git a/toolkit/components/search/schema/search-config-v2-schema.json b/toolkit/components/search/schema/search-config-v2-schema.json new file mode 100644 index 0000000000..cfd0124fa3 --- /dev/null +++ b/toolkit/components/search/schema/search-config-v2-schema.json @@ -0,0 +1,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"] + } + } + ] +} diff --git a/toolkit/components/search/schema/search-config-v2-ui-schema.json b/toolkit/components/search/schema/search-config-v2-ui-schema.json new file mode 100644 index 0000000000..c301fc6ceb --- /dev/null +++ b/toolkit/components/search/schema/search-config-v2-ui-schema.json @@ -0,0 +1,3 @@ +{ + "ui:order": ["recordType"] +} diff --git a/toolkit/components/search/schema/search-default-override-allowlist-schema.json b/toolkit/components/search/schema/search-default-override-allowlist-schema.json new file mode 100644 index 0000000000..6e48745832 --- /dev/null +++ b/toolkit/components/search/schema/search-default-override-allowlist-schema.json @@ -0,0 +1,54 @@ +{ + "type": "object", + "required": ["thirdPartyId", "overridesId", "urls"], + "properties": { + "thirdPartyId": { + "type": "string", + "title": "Third-party Add-on Id", + "description": "The identifier of the third party add-on which will override the app provided one. Should be of the format example@foo. If the third party engine is an OpenSearch engine, then this must be opensearch@search.mozilla.org", + "pattern": "^[a-zA-Z0-9-._]*@[a-zA-Z0-9-._]*$" + }, + "overridesId": { + "type": "string", + "title": "Add-on Id to Override", + "description": "The identifier of the app-provided add-on to be overridden. Should be of the format example@search.mozilla.org", + "pattern": "^[a-zA-Z0-9-._]*@search.mozilla.org$" + }, + "engineName": { + "type": "string", + "title": "Engine Name", + "description": "The name of the search engine to be overridden, only applies to OpenSearch engines" + }, + "urls": { + "type": "array", + "title": "URLs", + "description": "An array of URL sets which must be matched (with the add-on's manifest settings) to allow the override", + "items": { + "type": "object", + "required": ["search_url"], + "properties": { + "search_url": { + "type": "string", + "title": "search_url", + "description": "The main search url" + }, + "search_url_get_params": { + "type": "string", + "title": "search_url_get_params", + "description": "Any get parameters" + }, + "search_url_post_params": { + "type": "string", + "title": "search_url_post_params", + "description": "Any post parameters" + }, + "search_form": { + "type": "string", + "title": "search_form", + "description": "The search form url" + } + } + } + } + } +} diff --git a/toolkit/components/search/schema/search-default-override-allowlist-ui-schema.json b/toolkit/components/search/schema/search-default-override-allowlist-ui-schema.json new file mode 100644 index 0000000000..1b85489c13 --- /dev/null +++ b/toolkit/components/search/schema/search-default-override-allowlist-ui-schema.json @@ -0,0 +1,3 @@ +{ + "ui:order": ["thirdPartyId", "overridesId", "urls"] +} |