Skip to content

Fix pkgname for external response in Fiber strict server#1410

Open
ShouheiNishi wants to merge 1 commit intooapi-codegen:mainfrom
ShouheiNishi:fix/external-pkgname-for-fiber
Open

Fix pkgname for external response in Fiber strict server#1410
ShouheiNishi wants to merge 1 commit intooapi-codegen:mainfrom
ShouheiNishi:fix/external-pkgname-for-fiber

Conversation

@ShouheiNishi
Copy link
Copy Markdown
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
Copy Markdown
Member

Mind seeing if #1387 fixes this for you?

@ShouheiNishi
Copy link
Copy Markdown
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