My $0.02: I'm pro-validation but ambivalent about JSON Schema specifically.
However it should be straightforward for the auth server to convert from
JSON Schema to Joi validation objects via, e.g.
https://www.npmjs.com/package/enjoi, provided we can stick to the subset
that is implemented there (or wherever).

On Thu, Apr 28, 2016 at 8:13 AM, Mark Hammond <[email protected]> wrote:

> Hi all,
>   Edouard has been working on adding payloads to our push messages and we
> were having a bit of a discussion about how to define these payloads. This
> is becoming relevant to FxA and to Sync, hence I'm copying both lists.
>
> When defining the data in a payload for a certain message, both the server
> and the client must agree on the format. Initially we can manage this in an
> ad-hoc basis, but I'm not sure this scales particularly well.
>
> Somewhat inspired by the new telemetry data pipeline, I'm wondering if we
> should consider moving towards using JSONSchema (json-schema.org) to
> define our payloads? The benefits I see here are:
>
> * A single format that the client and server can use to describe and agree
> on the data being exchanged. We'd need to agree on a canonical location for
> a single schema that the client and server agree on, but that's probably
> doable.
>
> * Eventually unit tests on both the client and server could use this
> schema to validate the messages they send (or expect to receive). This
> would also be useful when mocking - eg, unit tests in the browser could
> confirm that the mocked data (ie, data we pretend came from the server)
> also conforms to the schema, to help validate that we are indeed testing
> data that looks like what the server actually sends.
>
> * All data can be validated without knowing the contents of the message.
>
> * All messages are likely to be somewhat consistent, given someone will
> need to define the schema and will use as reference other existing schemas.
>
> This is somewhat aspirational (ie, I'm not suggesting we would do all that
> work up-front), but there's already a bug on file to perform client-side
> schema validations for telemetry (bug 1249925) and we could possibly
> piggy-back off that work for the client side.
>
> Does anyone think this is worthwhile, or am I over-thinking the problem at
> hand and ad-hoc management of the payload definitions is OK?
>
> Cheers,
>
> Mark
> _______________________________________________
> Dev-fxacct mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/dev-fxacct
>
_______________________________________________
Sync-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/sync-dev

Reply via email to