-
Notifications
You must be signed in to change notification settings - Fork 5
Adding a new constraint to baton config schema #674
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
base: main
Are you sure you want to change the base?
Changes from all commits
4c53094
baed2e0
dd67a81
2c89935
63e3bd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -27,6 +27,7 @@ enum ConstraintKind { | |||
| CONSTRAINT_KIND_AT_LEAST_ONE = 2; | ||||
| CONSTRAINT_KIND_MUTUALLY_EXCLUSIVE = 3; | ||||
| CONSTRAINT_KIND_DEPENDENT_ON = 4; | ||||
| CONSTRAINT_KIND_ALLOWED_OPTIONS = 5; | ||||
| } | ||||
|
|
||||
| message Constraint { | ||||
|
|
@@ -36,6 +37,7 @@ message Constraint { | |||
| string name = 4; // optional | ||||
| string help_text = 5; // optional | ||||
| bool is_field_group = 6; | ||||
| repeated string allowed_option_values = 7; | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. StringField already has a StringRules that lets you specify a whitelist of allowed values. baton-sdk/proto/c1/config/v1/rules.proto Line 178 in 562e873
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Concrete example from the GitHub connector: when creating a team, the privacy field normally allows More details and a video walkthrough: DIR-146 I implemented this with Constraint messages on the action schema: Github PR with an example code is shared below: The alternative would be to add conditional logic directly to the rules, something like: But that couples validation rules to cross-field awareness, which gets complex quickly (nested conditions, multiple dependencies, etc.). What do you think? |
||||
| } | ||||
|
|
||||
| message FieldGroup { | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.