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

How can i resolve reference to Definition?? #47

Closed
TonyStark106 opened this issue May 11, 2016 · 4 comments
Closed

How can i resolve reference to Definition?? #47

TonyStark106 opened this issue May 11, 2016 · 4 comments
Labels

Comments

@TonyStark106
Copy link

ERROR (org.eclipse.xtext.diagnostics.Diagnostic.Linking) 'Couldn't resolve reference to Definition 'Result'.' on Type maxim.zaks.flatBuffers.impl.TypeImpl@6a1ebcff (primType: null, qualifiedType: null), lineNumber 13, length 6

@mzaks
Copy link
Owner

mzaks commented May 11, 2016

could you please paste your schema, Seems like Result is not defined or is of an unexpected type

@TonyStark106
Copy link
Author

TonyStark106 commented May 11, 2016

I have two fbs files in the same directory.It work by offical flatbuffers flatc -c command.Please forgive my terrible english.thank!

// commData.fbs
include "result.fbs";
namespace com.hyt258.hyt.protocol;
attribute "priority";
table FBData {
dataId: uint;
dataName: string;
}
table FBDataList {
res: Result (required);
DataList: [FBData];
}
root_type FBDataList;

// result.fbs
namespace com.hyt258.hyt.protocol;
attribute "priority";
table Result {
errCode: uint (id:0);
errMsg: string (id:1);
}
root_type Result;

@mzaks
Copy link
Owner

mzaks commented May 11, 2016

I see couple of things in your fbs files which is not supported yet by this code generator.

  1. include this is why you get the error, currently the code generator analyses only one file. I just added an issue, however I am not sure when I will implement it. Support include of other fbs files #48
  2. namespace there is an issue for that Support namespaces #15 but to be honest I am very close to put it to won't fix, because as we can see it in your example you use nested namespace as it is common in languages like Java, C# and maybe C++, languages which have a namespace/packe feature build in. In Swift there are only modules which can not be nested. I thought about nesting the classes inside of empty enum to emulate a namespace, but it feels ridicules to me. This is why I am close to set this feature to won't implement.
  3. required Support required attribute #10 I want to implement it soon.
  4. id attribute also on my list Support "id: n" attribute #9

So if you want to give it FlatBuffersSwift a spin now you would have to merge this two files. As I can see you are not referencing the types by fully qualified name so the namespace is not an issue.

On the side note. This statement:
attribute "priority";
Defines custom attributes which makes sense only if you have a custom code generator as far as I know.

@TonyStark106
Copy link
Author

Thank you for your precise answer.

@mzaks mzaks added the question label May 11, 2016
@mzaks mzaks closed this as completed May 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants