Skip to content

Commit

Permalink
Feat/default new api parser (#3683)
Browse files Browse the repository at this point in the history
  • Loading branch information
kesonan authored Nov 4, 2023
1 parent df2799f commit c8a8ff7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion tools/goctl/api/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ type parser struct {
spec *spec.ApiSpec
}

// Parse parses the api file
// Depreacted: use tools/goctl/pkg/parser/api/parser/parser.go:18 instead,
// it will be removed in the future.
// Parse parses the api file.
func Parse(filename string) (*spec.ApiSpec, error) {
if env.UseExperimental() {
return apiParser.Parse(filename, "")
Expand Down Expand Up @@ -61,11 +63,15 @@ func parseContent(content string, skipCheckTypeDeclaration bool, filename ...str
return apiSpec, nil
}

// Depreacted: use tools/goctl/pkg/parser/api/parser/parser.go:18 instead,
// it will be removed in the future.
// ParseContent parses the api content
func ParseContent(content string, filename ...string) (*spec.ApiSpec, error) {
return parseContent(content, false, filename...)
}

// Depreacted: use tools/goctl/pkg/parser/api/parser/parser.go:18 instead,
// it will be removed in the future.
// ParseContentWithParserSkipCheckTypeDeclaration parses the api content with skip check type declaration
func ParseContentWithParserSkipCheckTypeDeclaration(content string, filename ...string) (*spec.ApiSpec, error) {
return parseContent(content, true, filename...)
Expand Down
4 changes: 2 additions & 2 deletions tools/goctl/pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func init() {
if value := existsEnv.GetStringOr(GoctlCache, ""); value != "" {
goctlEnv.SetKV(GoctlCache, value)
}
experimental := existsEnv.GetOr(GoctlExperimental, ExperimentalOff)
experimental := existsEnv.GetOr(GoctlExperimental, ExperimentalOn)
goctlEnv.SetKV(GoctlExperimental, experimental)
}

Expand All @@ -77,7 +77,7 @@ func init() {
}

if !goctlEnv.HasKey(GoctlExperimental) {
goctlEnv.SetKV(GoctlExperimental, ExperimentalOff)
goctlEnv.SetKV(GoctlExperimental, ExperimentalOn)
}

goctlEnv.SetKV(GoctlVersion, version.BuildVersion)
Expand Down

0 comments on commit c8a8ff7

Please sign in to comment.