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

Duplicate declarations in generated types

Open popsu opened this issue 6 years ago • 3 comments

Hi,

I'm getting duplicate declarations of types in the generated code. I'm using this YAML file.

Code to reproduce:

curl "https://raw.githubusercontent.com/radiantearth/stac-api-spec/47eaaee5b22bc9fde796972c0206f964407fed09/STAC.yaml" >STAC.yaml
oapi-codegen -generate types STAC.yaml > types.gen.go

In the generated code I get duplicate declarations: Screenshot from 2020-11-20 17-09-08

Seems like the duplicate declarations are all from #/components/parameters, #/componenters/responses and #/components/schemas from the YAML file when there is name collision. For example there is bbox in #/components/parameters and #/components/schemas and they both get generated as Bbox type.

popsu avatar Nov 20 '20 15:11 popsu

Seems like this is duplicate of https://github.com/deepmap/oapi-codegen/issues/254

popsu avatar Nov 20 '20 15:11 popsu

Possibly a duplicate of https://github.com/deepmap/oapi-codegen/issues/386

migueleliasweb avatar Aug 26 '21 12:08 migueleliasweb

@popsu Any luck getting around this problem? I'm suffering from the exact same issue =(

migueleliasweb avatar Aug 29 '21 01:08 migueleliasweb