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

Non-Existent Types Referenced by `Response` `Schema`

Open linden opened this issue 2 years ago • 2 comments

I'm not sure why but sometimes generated type GetExampleResponse struct {}s reference non-existent types whose names start with a status code (illegal to have a type start with a digit so this refuses to format). This is only happening when the Schema type lacks a Title, so I'm guessing it's something to do with the substitution.

type GetExampleResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Limit   int                 `json:"limit"`
		Offset  int                 `json:"offset"`
		Results []200_Results_Item `json:"results"`
		Total   int                 `json:"total"`
	}
}

Here's a simplified example of what it looks like, notice the Results field references a (non-existent) type named 200_Results_Item. I'm trying to generate a wrapper around this spec, let me know if you need more information.

linden avatar Jun 19 '22 01:06 linden

I think this is the same as I saw in #626, which appears to mirror your issue

jamietanna avatar Jun 28 '22 20:06 jamietanna

Not sure if my issue is related to this one: https://github.com/deepmap/oapi-codegen/issues/1496

alexpyc avatar Mar 11 '24 07:03 alexpyc