[w3c/browser-payment-api] WebIDL serializer has been deprecated in favor of toJSON operation (#555)

Hi!

We recently [deprecated WebIDL serializers][0]. You can now directly specify [toJSON operations][1] instead, which you previously weren't allowed to do.

To deal with common cases, we added a new [\[Default\] extended attribute][2] which triggers the [default toJSON operation][3] that behaves similarly to how `serializers={attributes}` or `serializers={attributes, inherit}` used to. That is, it serializes all attributes that are of a [JSON type][4] into a vanilla JSON object.

It seems the following interfaces in this spec are impacted by this change:

- [ ] [`PaymentAddress`](https://w3c.github.io/browser-payment-api/#paymentaddress-interface)
- [ ] [`PaymentResponse `](https://w3c.github.io/browser-payment-api/#paymentresponse-interface)

Both of which seem good candidate for the [default toJSON operation][3], so the below should be all you need:

```webidl
[SecureContext]
interface PaymentResponse {
  [Default] object toJSON();
  // ...
};

[SecureContext]
interface PaymentAddress  {
  [Default] object toJSON();
  // ...
};
```

I'm sorry for the inconvenience this causes, but our hope is that this ultimately makes things a lot simpler and clearer for everybody.

Please feel free to reach out if you have any questions.

Thanks!

[0]: https://github.com/heycam/webidl/commit/a505f33
[1]: https://heycam.github.io/webidl/#idl-tojson-operation
[2]: https://heycam.github.io/webidl/#Default
[3]: https://heycam.github.io/webidl/#es-default-tojson
[4]: https://heycam.github.io/webidl/#dfn-json-types









 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/browser-payment-api/issues/555

Received on Wednesday, 21 June 2017 23:28:09 UTC