On 01/19/2015 02:55 PM, Douglas Mendizabal wrote:
Hi API WG,
I’m curious about something that came up during a bug discussion in one of the
Barbican weekly meetings. The question is about optional properties in an
entity. e.g. We have a Secret entity that has some properties that are
optional, such as the Secret’s name. We were split on what the best approach
for returning the secret representation would be when an optional property is
not set.
In one camp, some developers would like to see the properties returned no
matter what. That is to say, the Secret dictionary would include a key for
“name” set to null every single time. i.e.
{
…
“secret”: {
“name”: null,
…
}
...
}
On the other camp, some developers would like to see optional properties
omitted if they were not set by the user.
The advantage of always returning the property is that the response is easier
to parse, since you don’t have to check for the existence of the optional keys.
The argument against it is that it makes the API more rigid, and clients more
fragile.
I was wondering what the API Working Group’s thoughts are on this?
My opinion is that attributes should always be in the returned result
(that corresponds to a particular version of an API), set to null when
there is no value set.
Best,
-jay
__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev