Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Golang][client] Non-test files should not end in _test.go #448

Closed
grokify opened this issue Jul 3, 2018 · 0 comments · Fixed by #449
Closed

[Golang][client] Non-test files should not end in _test.go #448

grokify opened this issue Jul 3, 2018 · 0 comments · Fixed by #449

Comments

@grokify
Copy link
Member

grokify commented Jul 3, 2018

Description

Go client generator will create model files that end in _test.go when a definition / schema name ends in Test, _Test, or _test. These files are unreachable and not compiled in Go per the following:

When compiling packages, build ignores files that end in '_test.go'.

Ref: https://godoc.org/github.com/golang/go/src/cmd/go#hdr-Test_packages

The client generator should modify the filename when this is encountered.

openapi-generator version

3.0.3

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

Command line used for generation
$ bin/go-petstore.sh
Steps to reproduce

Create a program that attempts to use the following generated structs which are created by the spec and command above.

Definition Struct Name Filename
ArrayTest ArrayTest model_array_test.go
Enum_Test EnumTest model_enum_test.go
format_test FormatTest model_format_test.go
MapTest MapTest model_map_test.go
Related issues/PRs

#449

Suggest a fix/enhancement

Rename the files with an alternate suffix like _test_.go for model_array_test_.go similar to toParamName.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant