oapi-codegen
oapi-codegen copied to clipboard
Nested external references
Hi,
I've encountered an unusual behavior with code generation and wanted to share my findings. While I'm not entirely sure of the root cause, I was able to consistently reproduce the issue.
In summary, when using an external $ref that points to another external $ref within components.parameters (and possibly in components.responses as well), it results in broken aliases.
Here's PR with tests. Here's a link to broken alias.
I suppose it should be:
// IdParam defines model for IdParam.
type IdParam = externalRef1.IdParam
instead of:
// ExternalRef1IdParam defines model for IdParam.
type ExternalRef1IdParam = Id
since, it's an external ref for, IdParam:
parameters:
IdParam:
$ref: "idparam/spec.yaml#/components/parameters/IdParam"
Hi again @jamietanna, does this fix look good enough to be labeled for the next release?