Closed alombarte closed 7 years ago
This is a nice feature we can add to the framework with the following considerations:
collection
) before passing it to the filters. Keep in mind the name of the key can be modified in that filtering stage, just by adding the proper mapping for that backend in the config file (so you can change it to whatever)The implementation would transform the response from ["a",1]
to {"collection":["a",1]}
.
Here you have an example of how to change the name of the property:
{
"host": [
"https://jsonplaceholder.typicode.com"
],
"url_pattern": "/users",
"mapping": {
"collection": "users"
}
}
There are several reasons for returning an object:
By the way, using this new feature would have an small impact on the performance of the use-case (aka, throughput of the endpoint that aggregates a collection instead of a resource). We'll add a benchmark so everyone will know how small (or not) it is.
Feature added.
Feedback is welcome
This issue was marked as resolved a long time ago and now has been automatically locked as there has not been any recent activity after it. You can still open a new issue and reference this link.
Currently KrakenD is only processing responses from backends that return objects. Even returning objects is the usual case, it would be nice to support non-object responses such as lists. E.g: