-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Should notes only be of type array? #195
Comments
We discussed this in Toronto. I think the version of the schema that we looked at in Toronto had this array-or-string dual form for I agree that having only one form makes the schema and the parsing code both simpler, so that's a good argument in its favour. But having already made the decision one way before, we should be careful we're not overlooking any arguments on the other side. And should we do the same for Note that I'm inconsistent too: the WebExtensions macro assumes that |
Since we're not putting any code in the notes, supporting multiples statements is a straightforward way to separate notes on different topics. |
I'm not sure I buy the consistency argument and |
FWIW I agree with you, although I don't feel strongly either way. |
Now that the macro implementation is done for both paths, I don't have any strong feelings anymore either 😆 This would be a good issue for feedback from other consumers, but unfortunately we don't have any (known) users of the data yet. |
Late feedback from my side, though I agree with @Elchi3's initial argument that Sebastian |
I feel that it should always be an array, for consistency in part, but mainly because it simplifies code paths when interpreting the data, reducing the chances for bugs to occur. |
It maybe isn't a big enough deal to warrant changing all the files, but it'd always be preferable from the consumer side of things for the JSON to have only one data type if possible. For my BCD Explorer, I have to write code like this when parsing the notes: if (jsonKeys.includes('notes')) {
if (Array.isArray(json.notes)) {
contentForPopover.set("notes", `Notes: ${json.notes.join("<br>")}`);
} else {
contentForPopover.set("notes", `Notes: ${json.notes}`);
}
} when I could be writing it something like this: if (jsonKeys.includes('notes')) {
contentForPopover.set("notes", `Notes: ${json.notes.join("<br>")}`);
} |
We've been living with the two paths for a long time now and accept "string or array" for other properties as well, so I think we won't fix this after all. |
Noticed another small inconsistency between WebExtension data and CSS data (working on a macro really helps).
WebExtension data always uses arrays even if there is only 1 note in
notes
. I think this is better from a consumer's perspective. The name notes also implies this I think (notes not note).The docs say "notes is an array of zero or more translatable string containing additional pertinent information. If there are only 1 entry in the array, the array can be ommitted". I don't know the motivation behind this.
Proposed schema change:
Old:
New:
@wbamberg @teoli2003 thoughts?
The text was updated successfully, but these errors were encountered: