Skip to content

Commit

Permalink
docs: add model docstrings (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov authored Jun 19, 2024
1 parent 4dca345 commit 974eadc
Show file tree
Hide file tree
Showing 37 changed files with 4,309 additions and 3,271 deletions.
10 changes: 10 additions & 0 deletions generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,19 @@ func writeStruct(f *jen.File, s *Schema) error {
}

field = field.Tag(map[string]string{"json": strings.ReplaceAll(tag, `\`, "")})

// Adds a comment if it's not equal to the field name
if p.Description != "" && p.Description != p.CamelName {
field = field.Add(jen.Comment(p.Description))
}

fields = append(fields, field)
}

if s.Description != "" {
f.Comment(fmt.Sprintf("%s %s", s.CamelName, s.Description))
}

f.Type().Id(s.CamelName).Struct(fields...)

return nil
Expand Down
1 change: 1 addition & 0 deletions generator/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ type Schema struct {
Default any `json:"default"`
MinItems int `json:"minItems"`
Ref string `json:"$ref"`
Description string `json:"description"`
CamelName string `json:"for-hash-only!"`
required bool
name string
Expand Down
441 changes: 245 additions & 196 deletions handler/account/account.go

Large diffs are not rendered by default.

403 changes: 211 additions & 192 deletions handler/accountauthentication/accountauthentication.go

Large diffs are not rendered by default.

79 changes: 48 additions & 31 deletions handler/accountteam/accountteam.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 18 additions & 11 deletions handler/accountteammember/accountteammember.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

83 changes: 50 additions & 33 deletions handler/applicationuser/applicationuser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 974eadc

Please sign in to comment.