-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More mangling for generated package names and path #1804
Conversation
generator/shared_test.go
Outdated
@@ -458,6 +458,44 @@ func TestShared_MangleFileName(t *testing.T) { | |||
assert.True(t, strings.HasSuffix(res, "_test_swagger")) | |||
} | |||
|
|||
func TestShared_ManglePackagePath(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
461-478 lines are duplicate of generator/shared_test.go:480-497
generator/shared_test.go
Outdated
assert.Equal(t, "a/b/c-d/e_f/g_h", res) | ||
} | ||
|
||
func TestShared_ManglePackageName(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
480-497 lines are duplicate of generator/shared_test.go:461-478
generator/client_test.go
Outdated
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func testClientGenOpts() (g GenOpts) { | ||
g.Target = "." | ||
g.APIPackage = "operations" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string operations
has 2 occurrences, make it a constant
generator/client_test.go
Outdated
g.APIPackage = "operations" | ||
g.ModelPackage = "models" | ||
g.ServerPackage = "restapi" | ||
g.ClientPackage = "client" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string client
has 2 occurrences, make it a constant
generator/client_test.go
Outdated
assert.Error(t, err) | ||
|
||
opts = testClientGenOpts() | ||
opts.Spec = "../fixtures/petstores/petstore.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string ../fixtures/petstores/petstore.json
has 2 occurrences, make it a constant
generator/client_test.go
Outdated
g.Target = "." | ||
g.APIPackage = "operations" | ||
g.ModelPackage = "models" | ||
g.ServerPackage = "restapi" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string restapi
has 2 occurrences, make it a constant
generator/client_test.go
Outdated
func testClientGenOpts() (g GenOpts) { | ||
g.Target = "." | ||
g.APIPackage = "operations" | ||
g.ModelPackage = "models" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string models
has 4 occurrences, make it a constant
Codecov Report
@@ Coverage Diff @@
## master #1804 +/- ##
==========================================
+ Coverage 80.07% 80.41% +0.33%
==========================================
Files 38 38
Lines 7494 7521 +27
==========================================
+ Hits 6001 6048 +47
+ Misses 1014 1000 -14
+ Partials 479 473 -6
Continue to review full report at Codecov.
|
Makes generation functional and consistent regarding: * dashes in names * reserved suffixes, which are meaningful for go, like 'test' * sub-directories specified as target names (e.g. 'api/subdir') * packages for client, model and server * fixes go-swagger#1683 * fixes go-swagger#1157 * fixes go-swagger#1624 * replaces go-swagger#1790 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
* fixes go-swagger#1808 Thanks to @MrLuje for uncovering this issue. Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
* fixes go-swagger#1808 Thanks to @MrLuje for uncovering this issue. Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Fixed regression on Windows introduced by #1804
Makes generation functional and consistent regarding:
dashes in names
reserved suffixes, which are meaningful for go, like 'test'
sub-directories specified as target names (e.g. 'api/subdir')
packages for client, model and server
fixes Client wont compile with a route tagged "test" #1683
fixes Generate client does not handle "-" dashes in --client-package consistently #1157
fixes Can't have server code in subdirectory #1624
replaces WIP: Support server generation in a subdirectory #1624 #1790
Signed-off-by: Frederic BIDON fredbi@yahoo.com