SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
805 stars 171 forks source link

New group transformers added in 3.0.x #204

Closed grossmueller-espirit closed 7 years ago

grossmueller-espirit commented 7 years ago

Hi,

I have noticed that two additional group transformers have been added to the RH3 default restheart.yml. What is the purpose of "writeResult" and "hashProperties"? Should I add them to my restheart.yml when migrating from 2.0.2 to 3.0.x?

Thanks, Tanja

ujibang commented 7 years ago

hi @grossmueller-espirit

from HashTransformer javadoc

This transformer hashes the properties from the resource representation on write requests using the bcrypt hash function the properties to hash out are passed in the args argument as an array of strings. the bcrypt

example that hashes the property 'password' from the response:

{ rts: [{ "name": "hashProperties", 
             "phase":"REQUEST", 
             "scope":"CHILDREN",
             "args": { "props": ["password"], "complexity": 12 }}
         ]
}

writeResult is just an example that shows how to send a response body in a write request. it sends back a body as follows:

{  
   "oldData":  { ... }
   "newData" : { ... }
}
grossmueller-espirit commented 7 years ago

Hi @ujibang

thanks a lot for the information!