Hi all,

This is a follow-up for the discussion in Dublin PTG about how Neutron API 
server should handle invalid query parameter [1]. According to the feedback, I 
sent this ML to seek advice from API-WG in this regards.

As a brief recap, we were discussing how Neutron API server should behave if 
invalid query parameters were inputted. Per my understanding, the general 
consensus is to make Neutron API server behave consistently with other 
OpenStack projects. The question for API-WG is if there is any guideline to 
clarify how OpenStack projects should handle invalid query parameters. Query 
parameters are various across different projects but it seems most projects 
support these four categories of query parameters: sorting, pagination, 
filtering, and fields selection. I saw API-WG provided a guideline to define 
how to handle valid parameters of these categories [2], but it doesn't seem to 
define how to handle invalid parameters.

I wonder if API-WG could clarify it. For example, if users provide an invalid 
filter on listing the resources, should the API server ignore the invalid 
filter and return a successful response? Or it should return an error response? 
Below is a list of specific scenarios and examples to consider:

1. Invalid sorting. For example:

  GET "/v2.0/networks?sort_dir=desc&sort_key=<invalid_field>"
  GET "/v2.0/networks?sort_dir=<invalid_sort_dir>&sort_key=xxx"

2. Invalid pagination. For example:

  GET "/v2.0/networks?limit=<invalid_limit>&marker=xxx"
  GET "/v2.0/networks?limit=1&marker=<invalid_marker>"

3. Invalid filter. For example:

GET "/v2.0/networks?<invalid_field>=xxx"
GET "/v2.0/networks?xxx=<invalid_value>"

4. Invalid field. For example:

  GET "/v2.0/networks?fields=<invalid_field>"

Best regards,
Hongbin

[1] https://bugs.launchpad.net/neutron/+bug/1749820
[2] 
https://specs.openstack.org/openstack/api-wg/guidelines/pagination_filter_sort.html
__________________________________________________________________________
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

Reply via email to