Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible circular dependency on TS29571_CommonData.yaml (go 1.18) #47

Open
uri200 opened this issue May 19, 2022 · 2 comments
Open

Possible circular dependency on TS29571_CommonData.yaml (go 1.18) #47

uri200 opened this issue May 19, 2022 · 2 comments

Comments

@uri200
Copy link

uri200 commented May 19, 2022

Hello
I am using Rel-17 Dec'21 version from Jan 3

I may be wrong, but it looks like TS29571CommonData and TS29510_Nnrf_AccessToken depend on each other, so there seem not be a way to generate them (at least for for GO).

In previous versions TS29571CommonData did not depend of any other spec and it could be built independently. But that doesnt work anymore. Am I missing anything

Just in case, this is the command I am using is

//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/TS29510_Nnrf_AccessToken defs/TS29571_CommonData.yaml

go version go1.18 linux/amd64
@jdegre
Copy link
Owner

jdegre commented May 20, 2022

Hi Oriol,
Yes, you are correct, both 29.571 and 29.510 API make reference ($refs) to each other. This is something allowed by the OpenAPI spec, and the resolution works fine. This is not even a case of "circular reference", it just happens that there are schemas in each file referencing to schemas in the other file.

As it seems, this creates a problem on code generators, unfortunately. I really don't know how to solve that, other than reporting the issue in their repository and hope that they make some enhancement to address the issue.

A possible workaround I can think of is to pre-process each file with a "bundling" tool. E.g. (swagger-parser; see the "bundle" function there ("Bundles all referenced files/URLs into a single api that only has internal $ref pointers.").

After that, you can feed the output file into the code-generator. I don't know... just a thought...

@uri200
Copy link
Author

uri200 commented Jun 2, 2022

Thanks @jdegre note that swagger-codegen worked for me finally. I was not able to use other codegens though due to that circular ref.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants