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

Getting Plugin error: cycle in imports while trying bookstore sample yaml file #85

Open
piraveena opened this issue Sep 5, 2022 · 2 comments

Comments

@piraveena
Copy link

I'm trying with gnostic-grpc to convert a yaml file to proto file. I tried with my own sample obtained the above error. So i tried with the bookstore.yaml file.

Command
./gnostic --grpc-out=service /Users/piraveena/Documents/test/swagger.yaml

Error logs

level:INFO code:"DOCUMENTFIELDS" text:"Field: 'servers' is not supported for the OpenAPI document with title: Bookstore" keys:"servers"
level:INFO code:"DOCUMENTFIELDS" text:"Field: 'security' is not supported for the OpenAPI document with title: Bookstore" keys:"security"
level:INFO code:"COMPONENTSFIELDS" text:"Field: 'securitySchemes' is not supported for the component" keys:"components" keys:"securitySchemes"
level:INFO code:"SCHEMAFIELDS" text:"Field: 'required' is not supported for the schema: book" keys:"components" keys:"schemas" keys:"book" keys:"required"
level:INFO code:"SCHEMAFIELDS" text:"Field: 'required' is not supported for the schema: listBooksResponse" keys:"components" keys:"schemas" keys:"listBooksResponse" keys:"required"
level:INFO code:"SCHEMAFIELDS" text:"Field: 'required' is not supported for the schema: shelf" keys:"components" keys:"schemas" keys:"shelf" keys:"required"
level:INFO code:"SCHEMAFIELDS" text:"Field: 'required' is not supported for the schema: error" keys:"components" keys:"schemas" keys:"error" keys:"required"
level:INFO code:"REQUESTBODYFIELDS" text:"Field: 'required' is not supported for the request: createShelf" keys:"paths" keys:"/shelves" keys:"post" keys:"requestBody" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: shelf" keys:"paths" keys:"/shelves/{shelf}" keys:"get" keys:"parameters" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: shelf" keys:"paths" keys:"/shelves/{shelf}" keys:"delete" keys:"parameters" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: shelf" keys:"paths" keys:"/shelves/{shelf}/books" keys:"get" keys:"parameters" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: shelf" keys:"paths" keys:"/shelves/{shelf}/books" keys:"post" keys:"parameters" keys:"required"
level:INFO code:"REQUESTBODYFIELDS" text:"Field: 'required' is not supported for the request: createBook" keys:"paths" keys:"/shelves/{shelf}/books" keys:"post" keys:"requestBody" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: shelf" keys:"paths" keys:"/shelves/{shelf}/books/{book}" keys:"get" keys:"parameters" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: book" keys:"paths" keys:"/shelves/{shelf}/books/{book}" keys:"get" keys:"parameters" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: shelf" keys:"paths" keys:"/shelves/{shelf}/books/{book}" keys:"delete" keys:"parameters" keys:"required"
level:INFO code:"PARAMETERFIELDS" text:"Field: 'required' is not supported for parameter: book" keys:"paths" keys:"/shelves/{shelf}/books/{book}" keys:"delete" keys:"parameters" keys:"required"
Errors reading /Users/piraveena/Documents/test/swagger.yaml
Plugin error: [cycle in imports: swagger.proto -> swagger.proto]%    

Go version: go version go1.19 darwin/amd64
And I'm using latest gnostic-grpc

Any idea why I'm getting above errors

@harrycguo
Copy link

I've also got these errors. Could someone take a look?

@ilaleksin
Copy link

Hey, I encountered the same issue.

The easiest way to fix it is specifying a relative path to OpenAPI contract instead an abosule path.

Other possible solution:
The issue is most probably on gnostic side. Particularly, function isSymbolicReference works wrong if an absolute path specified.

One can try to add condition "if sourceName and ref are not the same file" in the if-statement.
It will break support of OpenAPI contracts distributed among multiple files. For example, other.yaml test will fail

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

3 participants