Use `service.NamedIdMap` to make lookup generation deterministic (#1678)

## Changes
Relies on this PR from Go SDK
https://github.com/databricks/databricks-sdk-go/pull/1016

See explanation there
This commit is contained in:
Andrew Nester 2024-08-14 15:52:09 +02:00 committed by GitHub
parent 53041346f2
commit f32902dc04
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -116,12 +116,12 @@ func allResolvers() *resolvers {
{{range .Services -}} {{range .Services -}}
{{- if in $allowlist .KebabName -}} {{- if in $allowlist .KebabName -}}
r.{{.Singular.PascalName}} = func(ctx context.Context, w *databricks.WorkspaceClient, name string) (string, error) { 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 { if err != nil {
return "", err 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 -}}
{{- end}} {{- end}}