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

Mark McClain mmcclain at yahoo-inc.com
Wed Jun 25 13:40:51 UTC 2014


On Jun 25, 2014, at 12:26 AM, Manish Godara <manishg at yahoo-inc.com> 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


More information about the OpenStack-dev mailing list