-
Notifications
You must be signed in to change notification settings - Fork 50
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
JSON keys are incompatible with Web IDL dictionaries #554
Comments
What inconvenience do you think is acceptable?
I'm assuming the former, but is that a violation of our priority of constituencies? Should we not favor web developers over "architectural purity"? Taking that view, either the API or the JSON should lose. We're looking at a similar issue with structured field naming in the PPA API. There's an equivalence with the API that we want to maintain there as well, with the convention for labels in fields being "foo-bar" instead. To add to the complication, it is not permissible to use "fooBar" because labels cannot include uppercase letters and "foo-bar" is similar not valid as a label in IDL/JS. |
I agree this is a bit annoying. I think the web has quite a few JSON formats now, so I wouldn't want to change this going forward. But maybe a carveout, like, "if your JSON format will very very often be used in tandem with a web platform API that accepts that object as an options dictionary, you can consider using the other casing rules" would be reasonable. |
Should that rule only apply to the portions of the JSON format that will be used in such a matter, or should that then go for the entire format per some "local consistency" argument? The former would make sense if you already know that's going to be the case. The latter might end up being more consistent with formats that only later introduce such a dependency. |
Oof, that's a tough one. I think if it was very clear that some portion was destined for JS, then maybe making it different from the rest of the JSON document would be reasonable. Like, if it was an object in a field named But if it's less clear-cut, then consistency across the whole document feels better to me. |
Per https://w3ctag.github.io/design-principles/#casing-rules an IDL dictionary member ends up as
fooBar
and an equivalent JSON key asfoo_bar
. When an API has both an imperative (IDL) and declarative (JSON) entry point, this can lead to awkward situations, as @saschanaz explains in w3c/push-api#385 (comment):I'm inclined to accept this inconvenience, but I wonder what other people think. We don't have that much JSON formats in the web platform so we could still change this I suspect.
Related: whatwg/infra#159.
cc @domenic @marcoscaceres @foolip
The text was updated successfully, but these errors were encountered: