NubeIO / module-core-rql

0 stars 0 forks source link

[RQL] Improve Variables #20

Closed CanuckMarc closed 1 week ago

CanuckMarc commented 4 months ago

Please make the following improvements to RQL Script Variables:

Change the Variable property to Value There are no existing implementations of RQL Scripts, so this change shouldn't be an issue.

Enforce JSON parse checks on all variable values Please add a JSON parse check to the Variable create/edit api. Reject the configuration if it doesn't parse as JSON. We should consider whether there is a need for a type change from any to something more restrictive to JSON format.

Add a Type property to Varibles. Variable Types will later be defined more specifically. This property will allow the UI to use the correct editor for the type of variable.

Localize variables to specific scripts by adding a ScriptUUID property. RQL Scripts will need to have local variables. Adding a ScriptUUID property will allow us to return only the variables that are specific to the RQL Script.

Add a Required property In future RQL Scripts will have variables that are required in order for the script to operate properly. This boolean flag will indicate to the UI whether it needs to be completed in order to function.

With the above improvements the updated RQLVariables struct should have this structure:

type RQLVariables struct {
    UUID               string `json:"uuid"`
    ScriptUUID      string `json:"script_uuid"`
    Name              string `json:"name"`
        Type                string `json:"type"`
    Value               any    `json:"value"`
        Required         bool   `json:"required"`
}
CanuckMarc commented 4 months ago

I edited my original comment to remove the Password property, as discussed.

CanuckMarc commented 4 months ago

@enjuthulung Can you please make these changes ASAP. Let me know if you have any questions.

Shiny380 commented 4 months ago

Enju, after the metric APIs