-
Notifications
You must be signed in to change notification settings - Fork 222
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
Allow for wildcard imports #676
Comments
Generally the problem with wildcard imports is that you can never be sure what is defined and what isn't. There are two scenarios I'm worried about if we added this:
|
Given the problems called out by @JordonPhillips, and given Smithy models are often maintained in multiple packages owned by different teams, I don't think we can support wildcard imports. The most significant issue is that if you use a wildcard import of another namespace, and the maintainer of that namespace adds a shape that conflicts with a shape defined your file, then you've got a build-time break due to the shape conflicts. This could be mitigated through some kind of cascading shape ID resolver, but that would add even more complexity to Smithy's shape ID resolution process (which currently has to account for forward references and the prelude). The other key reason we avoided wildcard imports is that they hinder code search. With the current import syntax, you can search for shapes by their fully qualified ID because the fully qualified ID is in the model file. This allows you to use simple tools like grep to look for shapes. Wildcard imports means you need some kind of semantic grep. |
I find the rationale satisfying, thank you 👍 |
Related to #636, I'm finding myself having to copy a large amount of built-in traits (as well as trait providers / validators) to a namespace I control, in order to cater to my users' use case.
Whilst I don'y mind doing so, I think it'd be convenient to be able to import everything from a specific namespace :
The text was updated successfully, but these errors were encountered: