-
Notifications
You must be signed in to change notification settings - Fork 939
feat: Expose the values contained in an HCL validation string to the API #1587
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,14 +24,37 @@ const ( | |
|
||
// Parameter represents a set value for the scope. | ||
type Parameter struct { | ||
ID uuid.UUID `db:"id" json:"id"` | ||
CreatedAt time.Time `db:"created_at" json:"created_at"` | ||
UpdatedAt time.Time `db:"updated_at" json:"updated_at"` | ||
Scope ParameterScope `db:"scope" json:"scope"` | ||
ScopeID uuid.UUID `db:"scope_id" json:"scope_id"` | ||
Name string `db:"name" json:"name"` | ||
SourceScheme database.ParameterSourceScheme `db:"source_scheme" json:"source_scheme"` | ||
DestinationScheme database.ParameterDestinationScheme `db:"destination_scheme" json:"destination_scheme"` | ||
ID uuid.UUID `json:"id"` | ||
CreatedAt time.Time `json:"created_at"` | ||
UpdatedAt time.Time `json:"updated_at"` | ||
Scope ParameterScope `json:"scope"` | ||
ScopeID uuid.UUID `json:"scope_id"` | ||
Name string `json:"name"` | ||
SourceScheme database.ParameterSourceScheme `json:"source_scheme"` | ||
DestinationScheme database.ParameterDestinationScheme `json:"destination_scheme"` | ||
Comment on lines
+33
to
+34
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. We should avoid importing database types into 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. Agreed, and fixed! |
||
} | ||
|
||
type ParameterSchema struct { | ||
ID uuid.UUID `json:"id"` | ||
CreatedAt time.Time `json:"created_at"` | ||
JobID uuid.UUID `json:"job_id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
DefaultSourceScheme string `json:"default_source_scheme"` | ||
DefaultSourceValue string `json:"default_source_value"` | ||
AllowOverrideSource bool `json:"allow_override_source"` | ||
DefaultDestinationScheme string `json:"default_destination_scheme"` | ||
AllowOverrideDestination bool `json:"allow_override_destination"` | ||
DefaultRefresh string `json:"default_refresh"` | ||
RedisplayValue bool `json:"redisplay_value"` | ||
ValidationError string `json:"validation_error"` | ||
ValidationCondition string `json:"validation_condition"` | ||
ValidationTypeSystem string `json:"validation_type_system"` | ||
ValidationValueType string `json:"validation_value_type"` | ||
|
||
// This is a special array of items provided if the validation condition | ||
// explicitly states the value must be one of a set. | ||
ValidationContains []string `json:"validation_contains"` | ||
} | ||
|
||
// CreateParameterRequest is used to create a new parameter value for a scope. | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figure we'll have validation conditions other than
contains
at some point, it's probably good to do this now:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our
contains
function already does this, and since it has to parse HCL I'd rather it be self-contained and reaaally well tested.