Hi all, apologies for jumping on this thread a few years later.

I have a similar question: suppose I have 2 different capnp files with the 
same file ID.

# file foo.capnp
0xabbeabbeabbeabbe;

struct Foo {
  val @0 : UInt32;
};

# file bar.capnp
0xabbeabbeabbeabbe;

struct Bar {
  val @1 : UInt32;
};

In my project, someone copy/pasted a file leading to two different schemas 
with the same file ID, 0xabbeabbeabbeabbe.
I find a use case where I want to import both of these capnp files and 
their types into a new one - of course this runs into a compilation error 
with the duplicate IDs.

I'd like to generate a new file ID to replace one of these, but I'm not 
sure if this would impact the autogenerated type IDs and break other 
systems.

Would merely changing the file ID affect the types that already exist in 
these files?

On Friday, November 27, 2020 at 7:27:09 AM UTC-8 ken...@cloudflare.com 
wrote:

> On Wed, Nov 25, 2020 at 3:43 PM Matt Stern <mjst...@gmail.com> wrote:
>
>> When I try to run capnp compile, I get the following:
>>
>> error: Import failed: /capnp/java.capnp
>>
>
> You will need to specify the same -I flags (import path) that you normally 
> specify to `capnp compile` when running the Java code generator.
>
> If I comment out the Java bits and just compile in C++ (which works for 
>> me), will this have any effect on the unique IDs for the structs in my 
>> schema file?
>>
>
> No, the auto-generated IDs do not in any way depend on the contents of 
> other files. Auto-generated IDs are constructed by concatenating the parent 
> scope ID and the type name, and then taking a hash of that.
>
> -Kenton
>

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/2970b31f-a1aa-45ac-bc6b-a95beb0b02b9n%40googlegroups.com.

Reply via email to