Skip to content

Commit

Permalink
render empty oauth scopes
Browse files Browse the repository at this point in the history
see #289
  • Loading branch information
khart-twilio authored and daveshanley committed May 11, 2024
1 parent 3d92fc0 commit a4a9370
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion datamodel/high/node_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func (n *NodeBuilder) AddYAMLNode(parent *yaml.Node, entry *nodes.NodeEntry) *ya
}

p := m.ToYamlNode(n, l)
if len(p.Content) > 0 {
if p.Content != nil {
valueNode = p
}
} else if r, ok := value.(Renderable); ok {
Expand Down
2 changes: 1 addition & 1 deletion datamodel/high/v3/oauth_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type OAuthFlow struct {
AuthorizationUrl string `json:"authorizationUrl,omitempty" yaml:"authorizationUrl,omitempty"`
TokenUrl string `json:"tokenUrl,omitempty" yaml:"tokenUrl,omitempty"`
RefreshUrl string `json:"refreshUrl,omitempty" yaml:"refreshUrl,omitempty"`
Scopes *orderedmap.Map[string, string] `json:"scopes,omitempty" yaml:"scopes,omitempty"`
Scopes *orderedmap.Map[string, string] `json:"scopes,renderZero" yaml:"scopes,renderZero"`
Extensions *orderedmap.Map[string, *yaml.Node] `json:"-" yaml:"-"`
low *low.OAuthFlow
}
Expand Down
3 changes: 3 additions & 0 deletions orderedmap/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ type findValueUntyped interface {
// ToYamlNode converts the ordered map to a yaml node ready for marshalling.
func (o *Map[K, V]) ToYamlNode(n NodeBuilder, l any) *yaml.Node {
p := utils.CreateEmptyMapNode()
if o != nil {
p.Content = make([]*yaml.Node, 0)
}

var vn *yaml.Node

Expand Down

0 comments on commit a4a9370

Please sign in to comment.