Skip to content

Commit

Permalink
enhancement: added default methods for dotnet
Browse files Browse the repository at this point in the history
  • Loading branch information
mahendraintelops committed Dec 10, 2023
1 parent 5094377 commit 6fcbbeb
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions internal/languages/dotnet/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ type LDotNetLangNode struct {

// FillDefaults constructor function
func (n *LDotNetLangNode) FillDefaults() error {
if n.LanguageNode != nil {
if n.LanguageNode.RestConfig != nil && n.LanguageNode.RestConfig.Server != nil && n.LanguageNode.RestConfig.Server.Resources != nil {
for _, resource := range n.LanguageNode.RestConfig.Server.Resources {
if resource.AllowedMethods == nil {
defaultMethods := []string{"GET", "POST", "PUT", "DELETE"}
stringPointers := func() []*string {
s := make([]*string, len(defaultMethods))
for i := range defaultMethods {
s[i] = &defaultMethods[i]
}
return s
}()

resource.AllowedMethods = stringPointers
}
}
}
}
return nil
}

Expand Down

0 comments on commit 6fcbbeb

Please sign in to comment.