[openstack-dev] [Keystone] Use JSON Schemas to validate API requests data
Bruno Semperlotti
bruno.semperlotti at gmail.com
Tue Jun 4 09:16:41 UTC 2013
Hi all,
Thanks for your replies on this topic !
As I am new to Python, I have taken a look at WSME/Pecan as suggested. It
seems to be great and clean web application framework.
I might not have get the total picture but it seems to me that there is not
a real validation but a strongly typed type declaration (using
wtypes.Base) which
seems to be very much like the java framework JAXB. Using json schema looks
easier and more flexible as I can set validation constraints on min/max
size, pattern, format without creating custom getter/setter for each
property.
Keystone is not using it for the moment, it will be a deep rewrite.
My primary thought was to keep it very simple, it looks a bit like what
have been done for Barbican.
- One schema per type describing it completely : User, Group... These
schemas can be regroup in a single file as they should not be too big.
- A set of functions to load appropriate schema, set the required fields
as they can be different for create/update operations (this should
avoid schema jungle), validate and get the errors.
- Explicitly call validation in keystone.identity.controller or maybe do a
decorator
Dolph, I'm not familiar with the middleware mechanism in keystone.contrib,
can you provide a bit more explanation about your idea ? It would be a good
thing if keystoneclient can reuse the schema to do data validation as well
but why should the client provide the schemas ? I was more thinking of
schemas accessible through the public API for client to validate it's
requests. For me the only critical point for data validation is server
input data.
A newbie's question : What is the standard way to share my current code
with you all ? I've seen the command "git review -D" to make a draft, is it
the correct way ? If yes, is the branch name important ?
Regards,
--
Bruno Semperlotti
On Mon, Jun 3, 2013 at 10:11 PM, Jarret Raim <jarret.raim at rackspace.com>wrote:
> > > I don't get the same impression. The consensus is that we're going to
> > > move to Pecan/WSME as projects need to write an API, but we were not
> > > going to both re-writing old API code just for the fun of it.
> > >
> > > Off the top of my head, I believe that in addition to ceilometer and
> > > ironic are both using pecan, and someone else was talking about it for
> > > their next api rev - but I honestly don't remember.
> > >
> > > At the very least I believe it was as decided as anything is around
> > > here that we'd start using pecan/WSME for new things.
> >
> > Right.
>
> Alright, fair enough. I'll take a deeper look at Pecan.
>
>
>
> Jarret
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130604/825f5e17/attachment.html>
More information about the OpenStack-dev
mailing list