oapi-codegen
oapi-codegen copied to clipboard
Fix pkgname for external response in Fiber strict server
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.
Mind seeing if #1387 fixes this for you?
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 <[email protected]>
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 <[email protected]>
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
$