Codegen: Add support for optional maps (#60883)

This commit is contained in:
sam boyer 2023-01-03 02:12:48 -05:00 committed by GitHub
parent 3ceb3edcb9
commit 7fd1d5cef0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -21,7 +21,7 @@ lineage: seqs: [
// TODO - it seems it's a team_member.permission, unlikely it should belong to the team kind
permission: #Permission @grafanamaturity(ToMetadata="kind", MaybeRemove)
// AccessControl metadata associated with a given resource.
accessControl: [string]: bool @grafanamaturity(ToMetadata="sys")
accessControl?: [string]: bool @grafanamaturity(ToMetadata="sys")
// Created indicates when the team was created.
created: int64 @grafanamaturity(ToMetadata="sys")
// Updated indicates when the team was updated.

View File

@ -18,7 +18,7 @@ export interface Team {
/**
* AccessControl metadata associated with a given resource.
*/
accessControl: Record<string, unknown>;
accessControl?: Record<string, unknown>;
/**
* AvatarUrl is the team's avatar URL.
*/

View File

@ -220,7 +220,7 @@ func DecoderCompactor() dstutil.ApplyFunc {
c.Delete()
}
case *dst.Field:
if id, is := x.Type.(*dst.Ident); is {
if id, is := ddepoint(x.Type).(*dst.Ident); is {
if expr, has := replace[id.Name]; has {
x.Type = expr
}

View File

@ -25,7 +25,7 @@ type Permission int
// Team defines model for team.
type Team struct {
// AccessControl metadata associated with a given resource.
AccessControl map[string]bool `json:"accessControl"`
AccessControl map[string]bool `json:"accessControl,omitempty"`
// AvatarUrl is the team's avatar URL.
AvatarUrl *string `json:"avatarUrl,omitempty"`