W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2015

Re: in webIDL can a required dictionary member be nullable?

From: Boris Zbarsky <bzbarsky@mit.edu>
Date: Mon, 20 Jul 2015 21:20:18 -0400
Message-ID: <55AD9E52.1030207@mit.edu>
To: =JeffH <Jeff.Hodges@KingsMountain.com>, public-script-coord@w3.org
On 7/18/15 2:06 PM, =JeffH wrote:
> if we declare this non-nullable variant in a spec..
>
>     dictionary foo-EmptyStringOK {
>       required DOMString bar;
>       required DOMString baz;
>     };
>
> ..where the above is intended to describe a JSON-serialized on-the-wire
> message, is it legitimate to have actual message instances where the
> value of bar or baz are empty strings, eg "" ?

Sure.

> my understanding is that a serialization of {"bar":null,"baz":null}
> would NOT be ok in the case of foo-EmptyStringOK

Yes.

> but would be ok in the
> case of the foo dictionary way up above because the DOMString members
> therein are declared as nullable.

Correct.

-Boris
Received on Tuesday, 21 July 2015 01:20:51 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 21 July 2015 01:20:51 UTC