oapi-codegen happily generates bad openAPI schema that has duplicated fields
Let me know if this is not in the scope of this project, I assumed it would be but I understand if it's not.
While I was working I had some mistake in my openAPI schema at some point, and the yaml was invalid. oapi-codegen happily generated code for it though, without any errors. This doesn't sound like good behaviour, and I would assume that if fed bad input, oapi-codegen should reject it and error.
example openAPI schema:
...
components:
schemas:
foo:
type: string
foo:
type: string
my yaml language server complained, but the generation worked "without issues".
I have noticed similar issues too. In one instance, where I was describing the requestBody that was made up of an array of objects, oapi-codegen generated a Go struct field that denoted an array of interfaces. So I wrote a Makefile line to replace this array of interfaces with array of structs. But then I checked the yaml file using an online validator and it turned out I had made a typo in it (item instead items, IIRC). When I fixed the typo, oapi-codegen generated the expected output.
Thanks for flagging - under the hood we use https://github.com/getkin/kin-openapi so it may be worth flagging the issue there, as it's not really one that we can solve on our side!