How much they depend on one another is up to you.
You could have the microservices using the same code base (possibly different versions of it)
You can have a shared API library they both depend on, but the rest of the code is in different modules. This is my preferred approach. Even if the versions used are inconsistent, this doesn't have to be a problem (see below)
You can have different copies of the interface provided they are compatible enough.
For example;
- the method(s) you use have to have the same name (you can have a change of method name but this isn't supported)
- method(s) you don't use can be completely different or absent.
- if the method arguments have an assumed type (ie the type is omitted) only the mandatory field names of your data transfer objects need to match. Optional fields can be added or dropped.
- some types can be automatically converted and don't need to match.
- the package for a class and even it's name doesn't have to match (provided you have given a mapping)
Regards,
Peter.