From: Stephen Hemminger <stephen@networkplumber.org>
To: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
Cc: Roopa Prabhu <roopa@cumulusnetworks.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Nikolay Aleksandrov <nikolay@cumulusnetworks.com>,
Julien Fortin <julien@cumulusnetworks.com>
Subject: Re: [PATCH iproute2 net-next v3 1/5] json_writer: allow base json data type to be array or object
Date: Tue, 21 Jun 2016 09:52:44 -0700 [thread overview]
Message-ID: <20160621095244.6563e26b@xeon-e3> (raw)
In-Reply-To: <CACcJQnTPheYi488FBYyZu=nYHKghxDbyeEM0pWM73ZcdBGU6Rg@mail.gmail.com>
On Tue, 21 Jun 2016 09:24:50 -0700
Anuradha Karuppiah <anuradhak@cumulusnetworks.com> wrote:
> On Tue, Jun 21, 2016 at 9:12 AM, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > On Mon, 20 Jun 2016 23:39:43 -0700
> > Roopa Prabhu <roopa@cumulusnetworks.com> wrote:
> >
> >> From: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
> >>
> >> This patch adds a type qualifier to json_writer. Type can be a
> >> json object or array. This can be extended to other types like
> >> json-string, json-number etc in the future.
> >>
> >> Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
> >
> > Since json writer is not used in many places yet, why not just
> > get rid of the automatic object in the constructor.
>
> I wanted to force the external api to start with an json-object or
> json-array. It reduces the chance of mistakes vs. a typeless
> constructor. With a typeless constructor you can accidentally end up
> with a json output that doesn't pass json lint; especially if optional
> params are being suppressed at different places.
Still, this is not how jsonwriter works in .NET, Android, or Java.
It is easily confusing to developers if similar API's behave
differently. Kind of like if printf() always appended a new line
on some platforms.
next prev parent reply other threads:[~2016-06-21 17:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 6:39 [PATCH iproute2 net-next v3 0/5] bridge: json support for fdb and vlan show Roopa Prabhu
2016-06-21 6:39 ` [PATCH iproute2 net-next v3 1/5] json_writer: allow base json data type to be array or object Roopa Prabhu
2016-06-21 16:12 ` Stephen Hemminger
2016-06-21 16:24 ` Anuradha Karuppiah
2016-06-21 16:52 ` Stephen Hemminger [this message]
2016-06-21 6:39 ` [PATCH iproute2 net-next v3 2/5] bridge: add json support for bridge vlan show Roopa Prabhu
2016-06-21 6:39 ` [PATCH iproute2 net-next v3 3/5] bridge: add json support for bridge fdb show Roopa Prabhu
2016-06-21 6:39 ` [PATCH iproute2 net-next v3 4/5] bridge: add json schema " Roopa Prabhu
2016-06-21 6:39 ` [PATCH iproute2 net-next v3 5/5] bridge: update man page Roopa Prabhu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160621095244.6563e26b@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=anuradhak@cumulusnetworks.com \
--cc=julien@cumulusnetworks.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=roopa@cumulusnetworks.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).