Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ajmcquilkin
Copy link

@ajmcquilkin ajmcquilkin commented May 4, 2023

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

@oscartbeaumont oscartbeaumont added the breaking change This will probs end up in the next major version. label May 4, 2023
@oscartbeaumont oscartbeaumont linked an issue May 4, 2023 that may be closed by this pull request
@oscartbeaumont
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This will probs end up in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Discussion] Plans to support duplicate type names?
2 participants