Skip to content

Commit

Permalink
Revert "Add --parseInternal flag to support internal underlying types (
Browse files Browse the repository at this point in the history
…swaggo#508)"

This reverts commit df54d45
  • Loading branch information
kirill-a-belov committed Sep 9, 2019
1 parent 8da9200 commit a143ebd
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 18 deletions.
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -74,7 +74,6 @@ OPTIONS:
--output value, -o value Output directory for al the generated files(swagger.json, swagger.yaml and doc.go) (default: "./docs")
--parseVendor Parse go files in 'vendor' folder, disabled by default
--parseDependency Parse go files in outside dependency folder, disabled by default
--parseInternal Parse go files in internal packages, disabled by default
```

## Supported Web Frameworks
Expand Down
7 changes: 0 additions & 7 deletions cmd/swag/main.go
Expand Up @@ -16,7 +16,6 @@ const propertyStrategyFlag = "propertyStrategy"
const outputFlag = "output"
const parseVendorFlag = "parseVendor"
const parseDependency = "parseDependency"
const parseInternal = "parseInternal"
const markdownFilesDirFlag = "markdownFiles"

func main() {
Expand All @@ -35,7 +34,6 @@ func main() {
outputDir := c.String(outputFlag)
parseVendor := c.Bool(parseVendorFlag)
parseDependency := c.Bool(parseDependency)
parseInternal := c.Bool(parseInternal)
markdownFilesDir := c.String(markdownFilesDirFlag)

switch strategy {
Expand All @@ -51,7 +49,6 @@ func main() {
OutputDir: outputDir,
ParseVendor: parseVendor,
ParseDependency: parseDependency,
ParseInternal: parseInternal,
MarkdownFilesDir: markdownFilesDir,
})
},
Expand Down Expand Up @@ -84,10 +81,6 @@ func main() {
Name: "parseDependency",
Usage: "Parse go files in outside dependency folder, disabled by default",
},
cli.BoolFlag{
Name: "parseInternal",
Usage: "Parse go files in internal packages, disabled by default",
},
cli.StringFlag{
Name: "markdownFiles, md",
Value: "",
Expand Down
4 changes: 0 additions & 4 deletions gen/gen.go
Expand Up @@ -47,9 +47,6 @@ type Config struct {
// ParseDependencies whether swag should be parse outside dependency folder
ParseDependency bool

// ParseInternal whether swag should parse internal packages
ParseInternal bool

// MarkdownFilesDir used to find markdownfiles, which can be used for tag descriptions
MarkdownFilesDir string
}
Expand All @@ -65,7 +62,6 @@ func (g *Gen) Build(config *Config) error {
p.PropNamingStrategy = config.PropNamingStrategy
p.ParseVendor = config.ParseVendor
p.ParseDependency = config.ParseDependency
p.ParseInternal = config.ParseInternal

if err := p.ParseAPI(config.SearchDir, config.MainAPIFile); err != nil {
return err
Expand Down
7 changes: 1 addition & 6 deletions parser.go
Expand Up @@ -59,9 +59,6 @@ type Parser struct {
// ParseDependencies whether swag should be parse outside dependency folder
ParseDependency bool

// ParseInternal whether swag should parse internal packages
ParseInternal bool

// structStack stores full names of the structures that were already parsed or are being parsed now
structStack []string

Expand Down Expand Up @@ -115,7 +112,6 @@ func (parser *Parser) ParseAPI(searchDir string, mainAPIFile string) error {
}

var t depth.Tree
t.ResolveInternal = true

absMainAPIFilePath, err := filepath.Abs(filepath.Join(searchDir, mainAPIFile))
if err != nil {
Expand Down Expand Up @@ -1285,8 +1281,7 @@ func (parser *Parser) getAllGoFileInfo(searchDir string) error {
}

func (parser *Parser) getAllGoFileInfoFromDeps(pkg *depth.Pkg) error {
ignoreInternal := pkg.Internal && !parser.ParseInternal
if ignoreInternal || !pkg.Resolved { // ignored internal and not resolved dependencies
if pkg.Internal || !pkg.Resolved { // ignored internal and not resolved dependencies
return nil
}

Expand Down

0 comments on commit a143ebd

Please sign in to comment.