diff --git a/_example/gen.go b/_example/gen.go deleted file mode 100644 index 5d666f1..0000000 --- a/_example/gen.go +++ /dev/null @@ -1,4 +0,0 @@ -package taskyapi - -//go:generate prmdg struct --file=./doc/schema/schema.json --package=taskyapi --output=./struct.go -//go:generate prmdg jsval --file=./doc/schema/schema.json --package=taskyapi --output=./validator.go diff --git a/main_test.go b/main_test.go index 0351b89..4f966d5 100644 --- a/main_test.go +++ b/main_test.go @@ -19,7 +19,7 @@ func TestGenerateStructFile(t *testing.T) { {Validator: true, UseTitle: true, Nullable: true}, } for _, c := range cases { - fp, err := os.Open("./_example/doc/schema/schema.json") + fp, err := os.Open("./testdata/doc/schema/schema.json") if err != nil { t.Fatal(err) } @@ -32,7 +32,7 @@ func TestGenerateStructFile(t *testing.T) { func TestGenerateJsValValidatorFile(t *testing.T) { pkg := "taskyapi" - fp, err := os.Open("./_example/doc/schema/schema.json") + fp, err := os.Open("./testdata/doc/schema/schema.json") if err != nil { t.Fatal(err) } @@ -45,7 +45,7 @@ func TestGenerateJsValValidatorFile(t *testing.T) { func TestGenerateValidatorFile(t *testing.T) { pkg := "taskyapi" - fp, err := os.Open("./_example/doc/schema/schema.json") + fp, err := os.Open("./testdata/doc/schema/schema.json") if err != nil { t.Fatal(err) } diff --git a/parser_test.go b/parser_test.go index d2387b5..0a7fcd6 100644 --- a/parser_test.go +++ b/parser_test.go @@ -7,7 +7,7 @@ import ( ) func testNewParser(t *testing.T) *Parser { - sc, err := schema.ReadFile("./_example/doc/schema/schema.json") + sc, err := schema.ReadFile("./testdata/doc/schema/schema.json") if err != nil { t.Fatal(err) } diff --git a/_example/doc/.bundle/config b/testdata/doc/.bundle/config similarity index 100% rename from _example/doc/.bundle/config rename to testdata/doc/.bundle/config diff --git a/_example/doc/Gemfile b/testdata/doc/Gemfile similarity index 100% rename from _example/doc/Gemfile rename to testdata/doc/Gemfile diff --git a/_example/doc/Gemfile.lock b/testdata/doc/Gemfile.lock similarity index 100% rename from _example/doc/Gemfile.lock rename to testdata/doc/Gemfile.lock diff --git a/_example/doc/README.md b/testdata/doc/README.md similarity index 100% rename from _example/doc/README.md rename to testdata/doc/README.md diff --git a/_example/doc/build.sh b/testdata/doc/build.sh similarity index 100% rename from _example/doc/build.sh rename to testdata/doc/build.sh diff --git a/_example/doc/schema/config.yml b/testdata/doc/schema/config.yml similarity index 100% rename from _example/doc/schema/config.yml rename to testdata/doc/schema/config.yml diff --git a/_example/doc/schema/heroku.json b/testdata/doc/schema/heroku.json similarity index 100% rename from _example/doc/schema/heroku.json rename to testdata/doc/schema/heroku.json diff --git a/_example/doc/schema/meta.yml b/testdata/doc/schema/meta.yml similarity index 100% rename from _example/doc/schema/meta.yml rename to testdata/doc/schema/meta.yml diff --git a/_example/doc/schema/overview.md b/testdata/doc/schema/overview.md similarity index 100% rename from _example/doc/schema/overview.md rename to testdata/doc/schema/overview.md diff --git a/_example/doc/schema/schema.json b/testdata/doc/schema/schema.json similarity index 100% rename from _example/doc/schema/schema.json rename to testdata/doc/schema/schema.json diff --git a/_example/doc/schema/schema.md b/testdata/doc/schema/schema.md similarity index 100% rename from _example/doc/schema/schema.md rename to testdata/doc/schema/schema.md diff --git a/_example/doc/schema/schemata/error.yml b/testdata/doc/schema/schemata/error.yml similarity index 100% rename from _example/doc/schema/schemata/error.yml rename to testdata/doc/schema/schemata/error.yml diff --git a/_example/doc/schema/schemata/task.yml b/testdata/doc/schema/schemata/task.yml similarity index 100% rename from _example/doc/schema/schemata/task.yml rename to testdata/doc/schema/schemata/task.yml diff --git a/_example/doc/schema/schemata/user.yml b/testdata/doc/schema/schemata/user.yml similarity index 100% rename from _example/doc/schema/schemata/user.yml rename to testdata/doc/schema/schemata/user.yml diff --git a/testdata/gen.go b/testdata/gen.go new file mode 100644 index 0000000..fff283f --- /dev/null +++ b/testdata/gen.go @@ -0,0 +1,4 @@ +package taskyapi + +//go:generate go run .. struct --file=./doc/schema/schema.json --package=taskyapi --output=./struct.go +//go:generate go run .. jsval --file=./doc/schema/schema.json --package=taskyapi --output=./validator.go diff --git a/_example/struct.go b/testdata/struct.go similarity index 100% rename from _example/struct.go rename to testdata/struct.go diff --git a/_example/validator.go b/testdata/validator.go similarity index 97% rename from _example/validator.go rename to testdata/validator.go index 230c0f8..5e53d9a 100644 --- a/_example/validator.go +++ b/testdata/validator.go @@ -1,6 +1,6 @@ package taskyapi -import jsval "github.com/lestrrat-go/go-jsval" +import "github.com/lestrrat-go/jsval" var TaskCreateValidator *jsval.JSVal var TaskInstancesValidator *jsval.JSVal