specta icon indicating copy to clipboard operation
specta copied to clipboard

[DRAFT] Add in support for duplicate type names across modules

Open ajmcquilkin opened this issue 2 years ago • 1 comments

This PR solves the problem from #62 where types with the same name are blocked even if they are in different Rust modules. Currently this code is not production ready, but I'll keep this PR up for reference and for when I get the time to productionize this code.

Currently this PR adds a new ModuleExportBehavior struct, that when enabled will append the module path of a struct to the beginning of its name. Take the following example:

mod app {
    mod protobufs {
        struct Waypoint { ... }
    }
}

The Waypoint struct would then be named app_protobufs_Waypoint within the generated code, allowing for duplicate type names.

Note: Tests are currently not passing

ajmcquilkin avatar May 04 '23 16:05 ajmcquilkin

For personal reference. Emit types into dedicated files based on module or into ts namespaces within the same file, configurable by user.

oscartbeaumont avatar Aug 20 '23 02:08 oscartbeaumont