Skip to content

Fix pkgname for external response in Fiber strict server #1410

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ShouheiNishi
Copy link
Contributor

@ShouheiNishi ShouheiNishi commented Dec 27, 2023

In Fiber strict server, when the response definition in another spec file is referenced from the operation, fix that the first letter of the package name in generated codes is capitalized incorrectly.

This PR fix #1405.

@ShouheiNishi ShouheiNishi marked this pull request as ready for review December 27, 2023 07:14
@jamietanna
Copy link
Member

Mind seeing if #1387 fixes this for you?

@ShouheiNishi
Copy link
Contributor Author

Mind seeing if #1387 fixes this for you?

No, it seems that PR#1387 does not fix issue #1405.

$ git log -n 2 HEAD
commit f13fbc6f08d59cfba607b8243b8703457115f9a4 (HEAD)
Merge: 8220763 520ad55
Author: Shouhei Nishi <shohei.nishi.tp@apresiasystems.co.jp>
Date:   Fri Jan 12 09:20:51 2024 +0900

    Merge remote-tracking branch 'deepmap/feature/external-ref-strict' into HEAD

commit 8220763819119c010c6a1e5434d9b95b66ac0a31 (github/reproduce/issue1405, reproduce/issue1405)
Author: Shouhei Nishi <shohei.nishi.tp@apresiasystems.co.jp>
Date:   Wed Dec 27 10:37:52 2023 +0900

    Test code for #1405
$ (cd internal/test ; go generate ./strict-server-response/... && go test ./strict-server-response/...)
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response [no test files]
# github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/chi/pkg1_test [github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/chi/pkg1.test]
strict-server-response/chi/pkg1/pkg1_test.go:20:46: cannot use pkg2.TestRespExtFixedJSONJSONResponse(pkg2.TestSchema{…}) (value of type pkg2.TestRespExtFixedJSONJSONResponse) as pkg2.TestSchema value in struct literal
# github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/echo/pkg1_test [github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/echo/pkg1.test]
strict-server-response/echo/pkg1/pkg1_test.go:21:46: cannot use pkg2.TestRespExtFixedJSONJSONResponse(pkg2.TestSchema{…}) (value of type pkg2.TestRespExtFixedJSONJSONResponse) as pkg2.TestSchema value in struct literal
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/chi/pkg2        [no test files]
FAIL    github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/chi/pkg1 [build failed]
# github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/fiber/pkg1
strict-server-response/fiber/pkg1/pkg1.gen.go:292:2: undefined: ExternalRef0
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/echo/pkg2       [no test files]
FAIL    github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/echo/pkg1 [build failed]
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/fiber/pkg2      [no test files]
FAIL    github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/fiber/pkg1 [build failed]
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/generator       [no test files]
# github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gorilla/pkg1_test [github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gorilla/pkg1.test]
strict-server-response/gorilla/pkg1/pkg1_test.go:20:46: cannot use pkg2.TestRespExtFixedJSONJSONResponse(pkg2.TestSchema{…}) (value of type pkg2.TestRespExtFixedJSONJSONResponse) as pkg2.TestSchema value in struct literal
# github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gin/pkg1_test [github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gin/pkg1.test]
strict-server-response/gin/pkg1/pkg1_test.go:21:46: cannot use pkg2.TestRespExtFixedJSONJSONResponse(pkg2.TestSchema{…}) (value of type pkg2.TestRespExtFixedJSONJSONResponse) as pkg2.TestSchema value in struct literal
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gin/pkg2        [no test files]
FAIL    github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gin/pkg1 [build failed]
FAIL    github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gorilla/pkg1 [build failed]
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/gorilla/pkg2    [no test files]
# github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/iris/pkg1_test [github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/iris/pkg1.test]
strict-server-response/iris/pkg1/pkg1_test.go:21:46: cannot use pkg2.TestRespExtFixedJSONJSONResponse(pkg2.TestSchema{…}) (value of type pkg2.TestRespExtFixedJSONJSONResponse) as pkg2.TestSchema value in struct literal
?       github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/iris/pkg2       [no test files]
FAIL    github.com/deepmap/oapi-codegen/v2/internal/test/strict-server-response/iris/pkg1 [build failed]
FAIL
$

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

Successfully merging this pull request may close these issues.

Fiber strict server with external referenced response is broken
2 participants