It is possible to define and document a schema of your messages (commands, events, queries). You can check https://docs.pact.io/ or https://spring.io/projects/spring-cloud-contract
I believe that you should reflect the relationship of your Bounded Contexts in the source code by implementing tests for this contracts. In addition to controlling contracts, you will have information who is consuming your API and how. This can form a baseline for introduce versioning of your API.
Axon location transparency enables you to deploy components (command side, query side, adapters/REST/WebSockets…) from your Bounded Context independently as well. The same concept of contract testing could be applied here, but I agree that this contracts are within the scope one team (one bounded context) and more pragmatic approach could be taken. Still, I think it worth the effort
If you are sharing the API (commands, events, queries) as libs/jars, make sure you have flat libs per service/bounded context: service-command1-api.jar, service-command2-api.jar, service-query1-api.jar… without common-api.jar please. Having a common API lib would make your language dirty, universal, and hard to decouple latter. You would be surprised how IBAN can have a different meaning (or usage) in different Bounded contexts. I know that this sounds enthusiastic, but I believe that we should converge to this in the future if we want to apply microservices architecture style. There is no silver bullet.
To go back to original question: example for remote queryGateway without shared api lib
I have not found any open source example of this yet. You can do this easily by simply copying the Queries (Java classes, full package name should match) from your Query application (producer of the queries) to your Adapter/Web/Client application (consumer of the queries). This will enable correct serialization/deserialization. Then you should invest your time in trying to implement PACT contract test for this so you can control the contract changes, and potentially share with the community…