You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, some of the commands contain special object with validation rules in the static property. This property is used by CommandContextValidator to check if context fits the rules. Main issue of this property is that it's documented in JSDoc and without this comment presented, this property will not give any hints about available and valid properties.
Describe the solution you'd like
I think it'll be better if these rules will be generated using some sort of builder class with the methods for all available options. Usage of this class might look like this:
classExampleCommandextendsBaseCommand{// Logic of the commandstaticvalidators=newValidatorBuilder().requireCallerPermission("ADMINISTRATOR").maxArguments(2).minArguments(1).argumentVariants(['option1','option2']).argumentRegexp(/^option[12]$/)}
With class like this it'll be easier to implement new features for the context validation and keep track of already existing ones.
Is your feature request related to a problem? Please describe.
Currently, some of the commands contain special object with validation rules in the static property. This property is used by
CommandContextValidator
to check if context fits the rules. Main issue of this property is that it's documented in JSDoc and without this comment presented, this property will not give any hints about available and valid properties.Describe the solution you'd like
I think it'll be better if these rules will be generated using some sort of builder class with the methods for all available options. Usage of this class might look like this:
With class like this it'll be easier to implement new features for the context validation and keep track of already existing ones.
Describe alternatives you've considered
—
Additional context
Example of the command with validators:
https://github.com/thecorecity/cognitum/blob/master/lib/commands/guild/LogSettingsCommand.js
The text was updated successfully, but these errors were encountered: