Skip to content
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

Ft/handle external pkg name in response #752

Merged

Conversation

masu-mi
Copy link
Contributor

@masu-mi masu-mi commented Sep 12, 2022

Overview

an example resolving of #751

changes

  • add test internal/test/issues/issue-removed-external-ref
  • add UppercaseFirstCharacterWithPkgName function for ucFirstWithPkgName filter
  • use ucFirstWithPkgName filter instead of ucFirst filter in template

@masu-mi masu-mi force-pushed the ft/handle-external-pkg-name-in-response branch from 61fe90a to 6a55f6f Compare September 13, 2022 03:49
    generate ./...

And update user code

* ./internal/test/strict-server/chi/server.go
* ./internal/test/strict-server/gin/server.go
* ./internal/test/strict-server/echo/server.go
@masu-mi masu-mi force-pushed the ft/handle-external-pkg-name-in-response branch 2 times, most recently from d577028 to d682e20 Compare September 15, 2022 05:47
@deepmap-marcinr deepmap-marcinr merged commit 895be61 into deepmap:master Oct 27, 2022
@deefdragon
Copy link
Contributor

I would like to note that this caused a break in a pattern I had been using in a pre-release.

Specifically, before this change, it was possible to return the type that was being referenced directly, but now that its embedded, It needs to be wrapped. (or a var created and the individual fields set.)

IE I have to return a api.Watchers204JSONResponse{} instead of my common api.NoContentJSONResponse{} now.

I feel like neither solution is perfect tho as making common code for the struct server may just be limited by go's type system/may need to be revisited after generic methods/type switches.

adrianpk pushed a commit to foorester/oapi-codegen that referenced this pull request Jan 16, 2024
* feat: add test case issue-removed-external-ref

* chore: go generate

* feat: fix broken pkg name

* fix: broken generated code of strict-interface.tmpl for external schema

* fix: broken strict-interface.tmpl

* Update generated code

    generate ./...

And update user code

* ./internal/test/strict-server/chi/server.go
* ./internal/test/strict-server/gin/server.go
* ./internal/test/strict-server/echo/server.go

Co-authored-by: Marcin Romaszewicz <47459980+deepmap-marcinr@users.noreply.github.com>
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.

None yet

3 participants