Skip to content

Commit

Permalink
Use service.NamedIdMap to make lookup generation deterministic (#1678)
Browse files Browse the repository at this point in the history
## Changes
Relies on this PR from Go SDK
databricks/databricks-sdk-go#1016

See explanation there
  • Loading branch information
andrewnester authored Aug 14, 2024
1 parent 5304134 commit f32902d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .codegen/lookup.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,12 @@ func allResolvers() *resolvers {
{{range .Services -}}
{{- if in $allowlist .KebabName -}}
r.{{.Singular.PascalName}} = func(ctx context.Context, w *databricks.WorkspaceClient, name string) (string, error) {
entity, err := w.{{.PascalName}}.GetBy{{range .List.NamedIdMap.NamePath}}{{.PascalName}}{{end}}(ctx, name)
entity, err := w.{{.PascalName}}.GetBy{{range .NamedIdMap.NamePath}}{{.PascalName}}{{end}}(ctx, name)
if err != nil {
return "", err
}

return fmt.Sprint(entity.{{ getOrDefault $customField .KebabName ((index .List.NamedIdMap.IdPath 0).PascalName) }}), nil
return fmt.Sprint(entity.{{ getOrDefault $customField .KebabName ((index .NamedIdMap.IdPath 0).PascalName) }}), nil
}
{{end -}}
{{- end}}
Expand Down

0 comments on commit f32902d

Please sign in to comment.