palantir / conjure-rust

Conjure support for Rust
Apache License 2.0
20 stars 11 forks source link

Partition objects/errors/clients/endpoints into separate top-level modules #279

Open sfackler opened 10 months ago

sfackler commented 10 months ago

We currently put the generated code for all Conjure types together in the same module. However, once we implement #121, we'll end up generating two traits for each endpoint, and there isn't a clear naming convention I can think of to disambiguate.

We should update the codegen to create separate top-level modules for each Conjure type to keep them separate from each other. For example, using the example API, we would have

use example_api::another::{TestServiceClient, TestService, TestServiceEndpoints, DifferentPackage};

change to

use example_api::{
    clients::another::TestServiceClient,
    endpoints::another::{TestService, TestServiceEndpoints},
    objects::another::DifferentPackage,
};

We could go further and split them into separate example_api_objects, example_api_clients, etc crates like conjure-java does, but that doesn't really seem worth it IMO.