the proposed solution would be to support the current configuration and introducing a specific key, for example '__options', to be used in case of conflicts, as follow
policy: {
Query: {
welcome: {
// no __options key present, so policy options are considered as it is
ttl: 6
},
hello: {
// since "hello" query has a ttl property
__options: {
ttl: 6
},
ttl: {
// here we can use both __options or list policy options
skip: () { /* .. */ }
}
}
}
}
at the moment, the definition for policy options is
this could lead to potential conflicts if there are nested entities with the same name of policy options (ttl, skip, storage and so on), for example
the proposed solution would be to support the current configuration and introducing a specific key, for example '__options', to be used in case of conflicts, as follow
also, adding validation for nested policies here https://github.com/mercurius-js/cache/blob/main/lib/validation.js#L82
cc @codeflyer