hyperledger-labs / convector

Smart Contract Systems the easy way. Open source development framework.
Other
146 stars 45 forks source link

Optional params and internal invokable calls #113

Closed diestrin closed 4 years ago

diestrin commented 4 years ago

Proposed changes

Call a invokable function was not possible due to the params manipulation of the decorator. This PR fixes the problem for internal function invocation by keeping track of the parameters in the right position. Also, while performing these changes, the lack of an OptionalParam decorator was evident, thus it was included to cover those scenarios.

Types of changes

What types of changes does your code introduce to Convector?

Checklist

Further comments

When you have an optional param in your invokable method, simply decorate it with @OptionalParam() in order to convector be aware of it and process it accordingly.

  @Invokable()
  public async optionalParam(
    @Param(yup.string())
    name: string,
    @OptionalParam()
    @Param(yup.string())
    sufix: string = 'test'
  )