hapijs / glue

Server composer for hapi.js
Other
245 stars 62 forks source link

Can I deprecate the pass-through of unknown plugin attributes with hapi v17? #103

Closed WesTyler closed 6 years ago

WesTyler commented 6 years ago

Glue currently preserves and passes through unknown plugin attributes to the hapi registration method as seen here.

According to the hapi tests, these are simply ignored.

Is there any problem with me removing the Hoek.cloneWithShallow found here since those properties do not need to be kept? I'm having to rewrite the parsePlugin method to support hapi v17 anyways, and the Hoek clone is making it more complicated.

csrl commented 6 years ago

The reason the clone is there is in order to not modify the input arguments, and thus modify the caller's manifest.

The reason unknown fields are allowed, is so that any of the registration override fields allowed in https://hapijs.com/api#serverregisterplugins-options-callback are supported eg. 'once', 'select', 'routes'. However, those technically aren't needed, since we only allow a single plugin per registration call anyway, so it is a redundant use case that we don't need to support. So I'm ok with removing that support.

Whatever approach you take, ensure the inputs arguments are not modified (eg. the caller's manifest should be the exact object before and after calling compose.

csrl commented 6 years ago

I think our discussion on the PR supersedes this.

WesTyler commented 6 years ago

Agreed. Thanks!

On Sat, Oct 21, 2017 at 4:56 PM csrl notifications@github.com wrote:

Closed #103 https://github.com/hapijs/glue/issues/103.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/hapijs/glue/issues/103#event-1304322440, or mute the thread https://github.com/notifications/unsubscribe-auth/ALl4O3fZQaGH_XQKnaOT-z9y0wWKyHa5ks5sumingaJpZM4QBl31 .

lock[bot] commented 4 years ago

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.