Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw param has no effect with custom Param Type #178

Closed
bouncehead13 opened this issue May 8, 2018 · 0 comments · May be fixed by Matthelonianxl/lisk-explorer#1, maxiplux/mum.cs425.project#5 or maxiplux/mum.cs425.project#7

Comments

@bouncehead13
Copy link

bouncehead13 commented May 8, 2018

Version: 5.0.18
Platform: Running with Angular (5.x)

Problem: I created a custom ParamType for many reasons, one being so that I didn't have to declare raw: true in so many places throughout our code. However, I am noticing the raw parameter is not carrying through to the Param itself.

{
  encode: ....,
  decode: ....,
  ...
  raw: true
}

This line of code shows that raw can be set from either the config or the type itself. However, from a few lines right above, I determined the type is getting reassigned. Within that logic it creates an ArrayType and the type's original value is never copied over.

Solution: I think it's just as simply as adding type.raw when creating an ArrayType as such. Code below copied and modified slightly from the source.

extend(this, {
  dynamic: type.dynamic,
  raw: type.raw    <----- add this
  name: type.name,
  pattern: type.pattern,
  inherit: type.inherit,
  is: arrayHandler(type.is.bind(type), true),
  $arrayMode: mode,
});

Without this fix, it simply just means every config needs to manually define the raw config param. Workaround, but not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment