OpenAPITools / OpenAPITools/openapi-generator

[REQ] [go-server] Move the EncodeJSONResponse to helpers.go

Open
#10,912 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

EncodeJSONResponse is currently in routers.go, but it's not even used in that file.

Personally, I don't use the routers feature provided by the generator, so I'd like to delete this file, but I can't because there is a function in it used by other code in the package.

Describe the solution you'd like

Move EncodeJSONResponse to helpers.go: it's a much better place for such a function.

Describe alternatives you've considered

Move the EncodeJSONResponse to its own file, but I don't think that's necessary.

Additional context

Happy to provide a PR if we can agree to the above.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating EncodeJSONResponse in routers.go and compare the surrounding package structure with helpers.go. Move the function to helpers.go while preserving its package usage, then run the relevant Go package tests to confirm the generated server code still builds and the routers.go dependency can be removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Refactor
Difficulty
2/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.