Skip to content

Commit

Permalink
additional doc annotations supported at the service handler level
Browse files Browse the repository at this point in the history
  • Loading branch information
bilal-bhatti committed Mar 4, 2024
1 parent 9b5eb1f commit e18463b
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 35 deletions.
1 change: 0 additions & 1 deletion internal/docparser/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func ParseDoc(pkgs []*packages.Package, doc string) (*DocData, error) {
}
}

// yaml.NewEncoder(os.Stdout).Encode(spec)
return &DocData{Doc: doc, Raw: lines, Comments: doclines, Data: spec}, nil
}

Expand Down
15 changes: 0 additions & 15 deletions internal/docparser/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,6 @@ func FindStruct(pkgs []*packages.Package, tname string) (map[string]interface{},
if _, ok := specType.Type.(*ast.StructType); ok {
if pkg.Name+"."+specType.Name.Name == tname {
obj = pkg.TypesInfo.Defs[specType.Name]
// fmt.Println("found object ", obj)
// schema, err := schema.FieldNew("--", obj.Type())
// if err != nil {
// fmt.Println("error generating schema", err)
// }

// if err := json.NewEncoder(os.Stdout).Encode(schema); err != nil {
// fmt.Println("error generating schema", err)
// }

// if len(strings.TrimSpace(specType.Doc.Text())) > 0 {
// fmt.Println("docs", specType.Doc.Text())
// } else {
// fmt.Println("docs", gd.Doc.Text())
// }
return false
}
}
Expand Down
16 changes: 0 additions & 16 deletions internal/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package internal

import (
"errors"
"fmt"
"go/ast"
"go/types"

Expand Down Expand Up @@ -45,24 +44,9 @@ func (p provider) typeTokenFor(vt *tokens.TypeToken) (*tokens.TypeToken, bool) {
func (p provider) provide(vt *tokens.TypeToken, retNames []string) (*tokens.FuncToken, error) {
debug.Trace("scanning packages for %s", vt.FullSignature)

// TODO : do additional response types
// id := ast.NewIdent("github.com/bilal-bhatti/zipline/example/models.ErrorResponse")
id := ast.NewIdent("ErrorResponse")

for _, pkg := range p.pkgs {
info := pkg.TypesInfo
if x, ok := info.Defs[id]; ok {
fmt.Println("x", x)
}

for _, v := range info.Defs {
// if v != nil {
// // if st, ok := v.Type().(*types.Struct); ok {
// if strings.HasSuffix(v.Type().String(), "models.ErrorResponse") {
// fmt.Println("def v", v, v.Type().String())
// }
// // }
// }
pf, ok := v.(*types.Func)
if !ok || !v.Exported() {
continue
Expand Down
3 changes: 0 additions & 3 deletions internal/swagger.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ func (s *swagger) generate(packets []*packet) error {
} else {
opId = b.id()
}
// fmt.Println(b.handler.docs.Data["operationId"])
op := &spec.Operation{
OperationProps: spec.OperationProps{
Description: "Route description",
Expand Down Expand Up @@ -226,8 +225,6 @@ func (s *swagger) generate(packets []*packet) error {
}

// Start: add parameters that are not in code, but are declared as overrides
// yaml.NewEncoder(os.Stdout).Encode(b.handler.docs.Data["parameters"])
// op.Parameters
overrides := b.handler.docs.Data["parameters"]
newparms := overriddenParams(overrides, op.Parameters)
for _, p := range newparms {
Expand Down

0 comments on commit e18463b

Please sign in to comment.