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

Conversation

foolip
Copy link
Collaborator

@foolip foolip commented Feb 5, 2021

Setting it explicitly to null or false is meaningless.

@foolip foolip requested a review from ddbeck as a code owner February 5, 2021 12:36
@github-actions github-actions bot added data:http 🚠 Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP docs ✍️ Issues or pull requests regarding the documentation of this project. schema ⚙️ Isses or pull requests regarding the JSON schema files used in this project. labels Feb 5, 2021
@foolip
Copy link
Collaborator Author

foolip commented Feb 5, 2021

This still needs work to actually enforce it, but I'm not sure if it's should go in compat-data.schema.json, in test-versions.js, or both?

@ddbeck
Copy link
Collaborator

ddbeck commented Feb 17, 2021

Change compat-data.schema.json. Then stuff like the VS Code settings will automatically pick this up. Let's mess with the linter only if there's confusion around the errors raised by the schema change.

Setting it explicitly to null or false is meaningless.
@foolip foolip force-pushed the version-removed-string-or-true branch from 0f831e2 to 518847c Compare March 6, 2021 11:23
"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.",
"allOf": [
{ "type": ["string", "boolean", "null"] },
{ "not": { "enum": ["true", "false", "null"] } }
Copy link
Collaborator 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.

"description": "A string or the value true, indicating which browser version removed this feature.",
"allOf": [
{ "type": ["string", "boolean"] },
{ "not": { "enum": ["true", false] } }
Copy link
Collaborator 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.

@foolip
Copy link
Collaborator Author

foolip commented Mar 6, 2021

@ddbeck I've updated compat-data.schema.json now.

Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

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

A couple little suggestions on the wording of the descriptions, but nothing major. Also, I checked out this branch locally and confirmed that the schema changed worked as expected by seeing my editor correctly flag some now-invalid changes. 👍

schemas/compat-data.schema.json Outdated Show resolved Hide resolved
"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.",
"allOf": [
{ "type": ["string", "boolean", "null"] },
{ "not": { "enum": ["true", "false", "null"] } }
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.

schemas/compat-data.schema.json Outdated Show resolved Hide resolved
foolip and others added 2 commits March 7, 2021 22:27
Co-authored-by: Daniel D. Beck <daniel@ddbeck.com>
Co-authored-by: Daniel D. Beck <daniel@ddbeck.com>
@foolip
Copy link
Collaborator Author

foolip commented Mar 7, 2021

@ddbeck suggestions applied!

Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

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

Thank you!

@ddbeck ddbeck requested a review from Elchi3 March 8, 2021 18:19
@ddbeck
Copy link
Collaborator

ddbeck commented Mar 8, 2021

@Elchi3 this is a (what looks to me a non-breaking) schema change, so I thought I'd give you a chance to review it too. Though if you're not concerned about it, dismiss the review request and I'll go ahead.

@foolip
Copy link
Collaborator Author

foolip commented Mar 8, 2021

Given that the data and schema go together, what would constitute a breaking schema change?

Since this change makes the schema stricter it should be breaking by some definition, but I'm not sure how in practice.

@ddbeck
Copy link
Collaborator

ddbeck commented Mar 8, 2021

This was my thinking: suppose we changed the data, but didn't change the schema. That wouldn't be breaking, though it would be the case that our data, at present, doesn't contain any "version_removed": false or "version_removed": null data (but still could, in the future—this is current state of non-real values in css for example). Consumers might (should, even) have code to handle such data, but none would appear in practice.

But by changing the schema, we're saying to consumers, "you can safely discard any code that expects "version_removed": false or "version_removed": null". Now that I've spelled this out, this sounds like a feature, so it's semver minor (e.g., the next version could be v3.2.0, not v3.1.4).

That said, if we wanted to play things safe, we could treat any schema change as breaking.

@foolip
Copy link
Collaborator Author

foolip commented Mar 8, 2021

Ah, right, the schema is our "API" and consumers can now make some more assumptions about the data, which is exactly why I made the change.

I don't particularly mind which part of the version is bumped, but could see the argument for either minor or patch version. Bumping the minor version might bring more attention to the change, allowing more consumers to simplify their code.

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

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

Makes sense to me! We should have had this from this start :)
Semver minor sounds good to me, too.

ddbeck added a commit to ddbeck/browser-compat-data that referenced this pull request Mar 9, 2021
@ddbeck ddbeck merged commit 9bc5f00 into mdn:master Mar 9, 2021
@ddbeck
Copy link
Collaborator

ddbeck commented Mar 9, 2021

Thanks, @foolip and @Elchi3! 🎉

I've started draft PR #9404 for this week's release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:http 🚠 Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP docs ✍️ Issues or pull requests regarding the documentation of this project. schema ⚙️ Isses or pull requests regarding the JSON schema files used in this project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants