Re: [openstack-dev] [Neutron] validation of input against column-size specified in schema

2014-06-25 Thread Mark McClain

On Jun 25, 2014, at 12:26 AM, Manish Godara  wrote:
> Hi,
> 
> Is there any way in current neutron codebase that can be used to validate
> the length of a string attribute against the max column size specified in
> the schema for that attribute.
> 
> E.g. , in models_v2.py
> 
> class Network(model_base.BASEV2, HasId, HasTenant):
>"""Represents a v2 neutron network."""
> 
>name = sa.Column(sa.String(255))
>...
> 
> 
> And if I want to validate the 'name' before storing in db, then how can I
> get the max allowable length given this definition?  I don't see any such
> validations being done in neutron for fields, so wondering how to do it.
> Maybe it's there and I missed it.
> 


There’s not any length validation currently as the original v2 API spec never 
specified the max field length.  One of the changes being made as part of the 
REST layer refactoring is that we’re adding length validation.

mark
___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [Neutron] validation of input against column-size specified in schema

2014-06-24 Thread Manish Godara
Hi,

Is there any way in current neutron codebase that can be used to validate
the length of a string attribute against the max column size specified in
the schema for that attribute.

E.g. , in models_v2.py

class Network(model_base.BASEV2, HasId, HasTenant):
"""Represents a v2 neutron network."""

name = sa.Column(sa.String(255))
...


And if I want to validate the 'name' before storing in db, then how can I
get the max allowable length given this definition?  I don't see any such
validations being done in neutron for fields, so wondering how to do it.
Maybe it's there and I missed it.


Regards,
manish


___
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev