Skip to content

fix: add mapstructure annotation to display_name #119

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

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions provider/decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ func TestDecode(t *testing.T) {
const (
legacyVariable = "Legacy Variable"
legacyVariableName = "Legacy Variable Name"

displayName = "Display Name"
)

aMap := map[string]interface{}{
"name": "Parameter Name",
"display_name": displayName,
"legacy_variable": legacyVariable,
"legacy_variable_name": legacyVariableName,
}

var param provider.Parameter
err := mapstructure.Decode(aMap, &param)
require.NoError(t, err)
require.Equal(t, displayName, param.DisplayName)
require.Equal(t, legacyVariable, param.LegacyVariable)
require.Equal(t, legacyVariableName, param.LegacyVariableName)
}
2 changes: 1 addition & 1 deletion provider/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const (
type Parameter struct {
Value string
Name string
DisplayName string
DisplayName string `mapstructure:"display_name"`
Description string
Type string
Mutable bool
Expand Down