8000 Support line comments on request & response fields by DomBlack · Pull Request #161 · encoredev/encore · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support line comments on request & response fields #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion parser/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,17 @@ func (p *parser) resolveType(pkg *est.Package, file *est.File, expr ast.Expr, ty
}

for _, name := range field.Names {
// Use the documentation block above the field by default,
// however if that is blank, then use the line comment instead
docBlock := field.Doc
if docBlock == nil || docBlock.Text() == "" {
docBlock = field.Comment
}

f := &schema.Field{
Typ: typ,
Name: name.Name,
Doc: field.Doc.Text(),
Doc: docBlock.Text(),
Optional: opts.Optional,
JsonName: opts.JSONName,
QueryStringName: opts.QueryStringName,
Expand Down
0