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

Expected behavior for circular includes in .fbs files? [all languages, flatc version 23.5.26, Ubuntu 24.04] #8302

Closed
andrew-otiv opened this issue May 8, 2024 · 1 comment

Comments

@andrew-otiv
Copy link

Are circular imports valid flatbuffer schema? Since other similar schemas seem to support it, IMO this should be specified somewhere in the flatbuffer documentation; in the absence of a formal spec, it could go here in the section on "Includes".

https://flatbuffers.dev/flatbuffers_guide_writing_schema.html

Whether or not circular imports are supported, here's a minimized example that I think should ether throw an error about the circular dependency, or successfully generate code, depending on the intended flatc behavior.

Minimized example:

// a.fbs 
include "b.fbs";
namespace a;

enum A : int {
  a = 0,
  b = 1,
  c = 2,
}
// b.fbs
include "a.fbs";
namespace b;

table B {
  some_a:a.A;
}
$ flatc --rust a.fbs

error:
  /home/andrew-otiv/otiv3/otiv3/middleware_types/minimized_example/a.fbs:9: 0: error: type referenced but not defined (check namespace): a.A, originally at: b.fbs:5

(The wider context)
The .fbs files were generated from .proto files containting the same circular import.
The .proto files were generated from .xsd files containing the same circular import.
This original circularity wasn't intentional and I'll try to resolve it at the source.

@andrew-otiv
Copy link
Author

Closing because our situation is changed. Thanks!

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

1 participant