oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

Client redeclared in this block when having schema with name Client

Open szaher opened this issue 3 years ago • 3 comments

When generating a client using https://develop.opsramp.com/downloads/opsramp-tenancy-access-controls.v2.yaml, it has a schema named Client

opsramp/tenancy_controls/tenancy.gen.go:1127:6: Client redeclared in this block

are there any solution to this issue other than change the schema name?

szaher avatar Feb 16 '22 12:02 szaher

Supposed there is a way to change code and use APIClient and APIServer instead of Client/Server. But this would brake back compatibility, so It should be done over some command line options.

I am newbie here, but able to make appropriate changes if there is no big objection about.

acmnu avatar Aug 17 '23 14:08 acmnu

Ooops. It is already done. See examples/custom-client-type/cfg.yaml.

So this one should be closed.

acmnu avatar Aug 17 '23 14:08 acmnu

output-options:
  response-type-suffix: Resp
  client-type-name: MyClient

Adding this fixed mine. Chaning the client name to something meaningful for you, and the response suffix.

jmaister avatar Oct 14 '24 21:10 jmaister