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

Circular dependencies

Open uri200 opened this issue 3 years ago • 2 comments

Hello We were using oapi-codegen with simple yaml files and it works properly. However I have encounter some issues on circular dependecies. For example We are trying to generate TS29571_CommonData, using

//go:generate oapi-codegen -generate types,skip-prune -o specs/TS29571CommonData/TS29571CommonData.gen.go --import-mapping TS29510_Nnrf_AccessToken.yaml:magma/feg/gateway/sbi/specs/TS29510NnrfAccessToken defs/TS29571_CommonData.yaml

This file has a dependency on TS29510_Nnrf_AccessToken.yml. But at the same time TS29510_Nnrf_AccessToken has a dependency on TS29571_CommonData.yml. So basically they depend on each other. So we can not generate the golang code for neither of each. Is there any way to provide multiple yml files so the code is generated using both defs?

uri200 avatar Jun 08 '22 20:06 uri200

i think this is also related to this issue https://github.com/deepmap/oapi-codegen/issues/42

uri200 avatar Jun 08 '22 21:06 uri200

In the meantime, a solution is to bundle specs, ie via https://www.jvt.me/posts/2022/02/10/bundle-openapi/

jamietanna avatar Sep 11 '22 06:09 jamietanna