webauthn icon indicating copy to clipboard operation
webauthn copied to clipboard

Align the order of fields in PublicKeyCredentialDescriptorJSON with PublicKeyCredentialDescriptor

Open zacknewman opened this issue 1 year ago • 2 comments

PublicKeyCredentialDescriptorJSON::id comes before PublicKeyCredentialDescriptorJSON::type despite PublicKeyCredentialDescriptor::id coming after PublicKeyCredentialDescriptor::type.

I realize that JSON deserialization should not assume the order of fields, but it would nonetheless be nice if the order of the fields were the same. While JSON is likely almost always used during client-server communication, it is not mandatory so it's possible other data exchange formats are used that do require the order of fields to match. When implementing multiple (de)serialization formats via the help of serialization frameworks like Serde, it's very beneficial to agree on field order. With both the JSON and "normal" types agreeing on field order, there is no "conflict" as to which to follow.

zacknewman avatar Jun 11 '24 17:06 zacknewman

Good observation, thanks!

(I first re-tagged this as editorial but then reverted that, because WebIDL dictionaries are in fact defined to be ordered)

emlun avatar Jun 11 '24 18:06 emlun

(As pointed out in #2083, the order of WebIDL dictionary members is lexicographical order, not source definition order, so this actually is an editorial change since the WebIDL definitions are equivalent)

emlun avatar Jun 12 '24 20:06 emlun

From WG Meeting (7/31): I'm aiming to get a PR to address this ready for review by next week's meeting.

MasterKale avatar Jul 31 '24 18:07 MasterKale