mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-05 07:49:37 +08:00
refactor: move converter from hrp internal to pkg
This commit is contained in:
24
hrp/pkg/convert/from_swagger.go
Normal file
24
hrp/pkg/convert/from_swagger.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package convert
|
||||
|
||||
import (
|
||||
"github.com/go-openapi/spec"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp"
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/builtin"
|
||||
)
|
||||
|
||||
func LoadSwaggerCase(path string) (*hrp.TCase, error) {
|
||||
// load swagger file
|
||||
caseSwagger := new(spec.Swagger)
|
||||
err := builtin.LoadFile(path, caseSwagger)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "load swagger file failed")
|
||||
}
|
||||
if caseSwagger.Definitions == nil {
|
||||
return nil, errors.New("invalid swagger case file, missing definitions")
|
||||
}
|
||||
|
||||
// TODO: convert swagger to TCase
|
||||
return nil, nil
|
||||
}
|
||||
Reference in New Issue
Block a user