Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require that version_removed is either a string or true #9015

Merged
merged 4 commits into from
Mar 9, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions http/headers/x-xss-protection.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
"version_added": true
},
"samsunginternet_android": {
"version_added": true,
"version_removed": false
"version_added": true
},
"webview_android": {
"version_added": false
Expand Down
12 changes: 6 additions & 6 deletions schemas/compat-data-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ entirely unknown. Examples:

#### `version_removed`

Contains a string with the version number the sub-feature was
removed in. It may also be a Boolean value of (`true` or `false`), or the
`null` value.
Contains a string with the version number the sub-feature was removed in.
It may also be `true`, meaning that it is unknown in which version support
was removed.

Default values:

- If `version_added` is set to `true`, `false`, or a string, `version_removed` defaults to `false`.
- if `version_added` is set to `null`, the default value of `version_removed` is also `null`.
- If `version_added` is set to `null`, the default value of `version_removed` is also `null`.

Examples:

Expand All @@ -237,12 +237,12 @@ Examples:
}
```

- Not removed (default if `version_added` is not `null`):
- Removed in some version after 3.5:

```json
{
"version_added": "3.5",
"version_removed": false
"version_removed": true
}
```

Expand Down
25 changes: 15 additions & 10 deletions schemas/compat-data.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,20 @@
"type": "boolean",
"description": "A boolean value indicating whether or not the implementation of the sub-feature deviates from the specification in a way that may cause compatibility problems. It defaults to false (no interoperability problems expected). If set to true, it is recommended that you add a note explaining how it diverges from the standard (such as that it implements an old version of the standard, for example)."
},
"version_added": { "$ref": "#/definitions/version_value" },
"version_removed": { "$ref": "#/definitions/version_value" },
"version_added": {
"description": "A string the value true, indicating which browser version added this feature, or the value false indicating the feature is not supported, or the value null indicating support is unknown.",
foolip marked this conversation as resolved.
Show resolved Hide resolved
"allOf": [
{ "type": ["string", "boolean", "null"] },
{ "not": { "enum": ["true", "false", "null"] } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's not obvious: the "true", "false" and "null" here merely disallow those strings, presumably to help highlight such mishaps in the editor. (The linter would also complain about it.)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. History of this is in #485.

]
},
"version_removed": {
"description": "A string or the value true, indicating which browser version removed this feature.",
foolip marked this conversation as resolved.
Show resolved Hide resolved
"allOf": [
{ "type": ["string", "boolean"] },
{ "not": { "enum": ["true", false] } }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the most obvious way of saying that true is an allowed value, but convenient since the string "true" is already excluded here.

]
},
"notes": {
"description": "A string or array of strings containing additional information.",
"anyOf": [
Expand All @@ -64,7 +76,7 @@
"required": ["version_added"],
"anyOf": [
{
"not": {"required": ["prefix","alternative_name"]}
"not": {"required": ["prefix", "alternative_name"]}
},
{
"oneOf": [
Expand Down Expand Up @@ -258,13 +270,6 @@
"^(?!__compat)[a-zA-Z_0-9-$@]*$" : { "$ref": "#/definitions/webextensions_identifier" }
},
"additionalProperties": false
},

"version_value": {
"allOf": [
{ "type": ["string", "boolean", "null"] },
{ "not": { "enum": ["true", "false", "null"] } }
]
}
},

Expand Down