Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in POST v2/op/update (batch op) validations fail for attr_value #2681

Closed
iariasleon opened this issue Nov 16, 2016 · 2 comments
Closed

in POST v2/op/update (batch op) validations fail for attr_value #2681

iariasleon opened this issue Nov 16, 2016 · 2 comments

Comments

@iariasleon
Copy link
Contributor

iariasleon commented Nov 16, 2016

case 1: forbidden chars are allowed in the attribute value

dataset used

      | attributes_value |
      |------------------|
      | house<flat>      |
      | house=flat       |
      | house"flat"      |
      | house'flat'      |
      | house;flat       |
      | house(flat)      |

update batch op request

url: POST http://localhost:1026/v2/op/update
headers:
    Content-Type: application/json
    Fiware-Service: test_op_update_attribute_value
    Fiware-ServicePath: /test
payload: {"entities": [{"type": "house", "temperature": {"value": "house(flat)", "metadata": {"warning": {"type": "alarm", "value": "hot"}}}, "id": "Wes"}], "actionType": "APPEND"}

update batch op response

http code: 204 - No Content
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: a222e0b8-abef-11e6-a733-005056a20feb
   Date: Wed, 16 Nov 2016 11:27:18 GMT
payload:

Expected response

http code: 400 - Bad Request
{"error":"BadRequest","description":"Invalid characters in attribute value"}

mongo docs

{ "_id" : { "id" : "1A6", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1479295856, "modDate" : 1479295856, "value" : "house<flat>", "md" : { "warning" : { "type" : "alarm", "value" : "hot" } }, "mdNames" : [ "warning" ] } }, "creDate" : 1479295856, "modDate" : 1479295856 }
{ "_id" : { "id" : "jDV", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1479295856, "modDate" : 1479295856, "value" : "house=flat", "md" : { "warning" : { "type" : "alarm", "value" : "hot" } }, "mdNames" : [ "warning" ] } }, "creDate" : 1479295856, "modDate" : 1479295856 }
{ "_id" : { "id" : "i3f", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1479295857, "modDate" : 1479295857, "value" : "house\"flat\"", "md" : { "warning" : { "type" : "alarm", "value" : "hot" } }, "mdNames" : [ "warning" ] } }, "creDate" : 1479295857, "modDate" : 1479295857 }
{ "_id" : { "id" : "eyL", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1479295857, "modDate" : 1479295857, "value" : "house'flat'", "md" : { "warning" : { "type" : "alarm", "value" : "hot" } }, "mdNames" : [ "warning" ] } }, "creDate" : 1479295857, "modDate" : 1479295857 }
{ "_id" : { "id" : "AsQ", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1479295857, "modDate" : 1479295857, "value" : "house;flat", "md" : { "warning" : { "type" : "alarm", "value" : "hot" } }, "mdNames" : [ "warning" ] } }, "creDate" : 1479295857, "modDate" : 1479295857 }
{ "_id" : { "id" : "Wes", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1479295857, "modDate" : 1479295857, "value" : "house(flat)", "md" : { "warning" : { "type" : "alarm", "value" : "hot" } }, "mdNames" : [ "warning" ] } }, "creDate" : 1479295857, "modDate" : 1479295857 }

@iariasleon iariasleon added this to the 1.6.0 milestone Nov 16, 2016
@iariasleon iariasleon changed the title in POST v2/op/update (batch op) ID validations fail for attr_type in POST v2/op/update (batch op) validations fail for attr_value Nov 16, 2016
fgalan added a commit that referenced this issue Nov 16, 2016
@iariasleon
Copy link
Contributor Author

LGTM

crbrox added a commit that referenced this issue Nov 17, 2016
@fgalan
Copy link
Member

fgalan commented Nov 17, 2016

Implemented by PR #2679 (functional test added in PR #2684)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants