lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACcJQnT6i-zcJrVeow4TWRU7q5pLeo+JBo38LK9Ptjj=G7O3Mw@mail.gmail.com>
Date:	Tue, 31 May 2016 12:22:36 -0700
From:	Anuradha Karuppiah <anuradhak@...ulusnetworks.com>
To:	Stephen Hemminger <stephen@...workplumber.org>
Cc:	Roopa Prabhu <roopa@...ulusnetworks.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Nikolay Aleksandrov <nikolay@...ulusnetworks.com>,
	julien@...ulusnetworks.com
Subject: Re: [PATCH iproute2 net-next 3/5] bridge: add json support for bridge
 fdb show

On Tue, May 31, 2016 at 11:59 AM, Stephen Hemminger
<stephen@...workplumber.org> wrote:
> On Fri, 27 May 2016 21:37:14 -0700
> Roopa Prabhu <roopa@...ulusnetworks.com> wrote:
>
>> Sample output:
>> $bridge -j fdb show
>> [{
>>         "mac": "44:38:39:00:69:88",
>>         "dev": "swp2s0",
>>         "vlan": 2,
>>         "master": "br0",
>>         "state": "permanent"
>>     },{
>>         "mac": "00:02:00:00:00:01",
>>         "dev": "swp2s0",
>>         "vlan": 2,
>>         "master": "br0"
>>     },{
>>         "mac": "00:02:00:00:00:02",
>>         "dev": "swp2s1",
>>         "vlan": 2,
>>         "master": "br0"
>>     },{
>>         "mac": "44:38:39:00:69:89",
>>         "dev": "swp2s1",
>>         "master": "br0",
>>         "state": "permanent"
>>     },{
>>         "mac": "44:38:39:00:69:89",
>>         "dev": "swp2s1",
>>         "vlan": 2,
>>         "master": "br0",
>>         "state": "permanent"
>>     },{
>>         "mac": "44:38:39:00:69:88",
>>         "dev": "br0",
>>         "master": "br0",
>>         "state": "permanent"
>>     }
>>     ]
>
> In most JSON I have seen, the output would be:
>
> {
>   "fdb" : [
>      {
>          "mac": "44:38:39:00:69:88",
>          "dev": "swp2s0",
>          "vlan": 2,
>          "master": "br0",
>          "state": "permanent"
>      },
> ...
>    ]
> }
>
> I.e never a bare array.
>
Yes Stephen, Adding an extra level would be one way to force the
format to json-object. And that would definitely be the way to do it
if we ever added a top level json dump - something like - "bridge -j
show".

But in the case of "bridge -j fdb show" that level is redundant. To be
consistent we would have to add that extra level to all json dumps
(even if they were already objects; such as the "bridge -j vlan
show").The google json style guide recommends against adding hierarchy
unless needed. And it is not that uncommon in java to have a
json-array of objects for e.g. http://json-schema.org/example1.html
talks about a schema that is an "array of products".

What do you recommend?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ