Skip to content

Commit

Permalink
Merge pull request #215 from nokia/gen-path-enum-vals
Browse files Browse the repository at this point in the history
add enum values to generate path cmd
  • Loading branch information
karimra authored Aug 31, 2023
2 parents d3c3292 + c550d07 commit 2fa83bc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type generatedPath struct {
Path string `json:"path,omitempty"`
PathWithPrefix string `json:"path-with-prefix,omitempty"`
Type string `json:"type,omitempty"`
EnumValues []string `json:"enum-values,omitempty"`
Description string `json:"description,omitempty"`
Default string `json:"default,omitempty"`
IsState bool `json:"is-state,omitempty"`
Expand Down Expand Up @@ -335,6 +336,9 @@ func (a *App) generatePath(entry *yang.Entry, pType string) *generatedPath {
gp.Description = entry.Description
if entry.Type != nil {
gp.Type = entry.Type.Name
if gp.Type == "enumeration" {
gp.EnumValues = entry.Type.Enum.Names()
}
} else if entry.IsList() {
gp.Type = "[list]"
} else {
Expand Down

0 comments on commit 2fa83bc

Please sign in to comment.