Prism · Transform
$renameKeys
Renames keys of an object where they stand, so the order of the keys is kept. A key that is not there is passed over.
{
endpoint: {
url: '/api/todos',
body: { done: false },
transform: 'rows',
},
}{
$renameKeys: {
from: { $ref: '$.endpoint' },
map: {
body: 'request',
transform: 'response',
headers: 'meta',
},
},
}{
url: '/api/todos',
request: { done: false },
response: 'rows',
}Runs in this page on the installed package. The input and the expected output are defined by the example.