Feat/default new api parser (#3683)
This commit is contained in:
@@ -17,7 +17,9 @@ type parser struct {
|
|||||||
spec *spec.ApiSpec
|
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) {
|
func Parse(filename string) (*spec.ApiSpec, error) {
|
||||||
if env.UseExperimental() {
|
if env.UseExperimental() {
|
||||||
return apiParser.Parse(filename, "")
|
return apiParser.Parse(filename, "")
|
||||||
@@ -61,11 +63,15 @@ func parseContent(content string, skipCheckTypeDeclaration bool, filename ...str
|
|||||||
return apiSpec, nil
|
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
|
// ParseContent parses the api content
|
||||||
func ParseContent(content string, filename ...string) (*spec.ApiSpec, error) {
|
func ParseContent(content string, filename ...string) (*spec.ApiSpec, error) {
|
||||||
return parseContent(content, false, filename...)
|
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
|
// ParseContentWithParserSkipCheckTypeDeclaration parses the api content with skip check type declaration
|
||||||
func ParseContentWithParserSkipCheckTypeDeclaration(content string, filename ...string) (*spec.ApiSpec, error) {
|
func ParseContentWithParserSkipCheckTypeDeclaration(content string, filename ...string) (*spec.ApiSpec, error) {
|
||||||
return parseContent(content, true, filename...)
|
return parseContent(content, true, filename...)
|
||||||
|
|||||||
4
tools/goctl/pkg/env/env.go
vendored
4
tools/goctl/pkg/env/env.go
vendored
@@ -60,7 +60,7 @@ func init() {
|
|||||||
if value := existsEnv.GetStringOr(GoctlCache, ""); value != "" {
|
if value := existsEnv.GetStringOr(GoctlCache, ""); value != "" {
|
||||||
goctlEnv.SetKV(GoctlCache, value)
|
goctlEnv.SetKV(GoctlCache, value)
|
||||||
}
|
}
|
||||||
experimental := existsEnv.GetOr(GoctlExperimental, ExperimentalOff)
|
experimental := existsEnv.GetOr(GoctlExperimental, ExperimentalOn)
|
||||||
goctlEnv.SetKV(GoctlExperimental, experimental)
|
goctlEnv.SetKV(GoctlExperimental, experimental)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !goctlEnv.HasKey(GoctlExperimental) {
|
if !goctlEnv.HasKey(GoctlExperimental) {
|
||||||
goctlEnv.SetKV(GoctlExperimental, ExperimentalOff)
|
goctlEnv.SetKV(GoctlExperimental, ExperimentalOn)
|
||||||
}
|
}
|
||||||
|
|
||||||
goctlEnv.SetKV(GoctlVersion, version.BuildVersion)
|
goctlEnv.SetKV(GoctlVersion, version.BuildVersion)
|
||||||
|
|||||||
Reference in New Issue
Block a user