Allowing of more generalized public namespacing #34
Replies: 2 comments 5 replies
-
|
Thanks for opening the issue @bschrag620. Right now, we only permit a single public folder - I think this would require multiple public folders. One workaround you can do right now is to have your public folder essentially just "alias" things in your other folders. So instead of defining the whole thing in your public folder, just creating a public constant that wraps the service or concern. It's a bit of extra boiler plate but otherwise should solve it for you. Long term, we've thought ideally that we could allow something to be public with a comment at the top of the file. This would give full flexibility to define what's public. Let me know what ya think! |
Beta Was this translation helpful? Give feedback.
-
|
My suggestion would be to allow for multiple public folders. It would also
mean that the public objects would begin within a Public:: namespace. This
does have a side benefit that when doing code review it is more easily
known that it is a publicly defined constant but perhaps that is a bit
redundant given the privacy checks in packwerk.
I do like the idea however of public declaration in a file. The motivation
for my suggestion was to allow for file structure to still follow the usual
patterns which the commenting approach would allow for.
…On Sat, Sep 16, 2023, 7:41 AM Alex Evanczuk ***@***.***> wrote:
Thanks for opening the issue @bschrag620 <https://github.com/bschrag620>.
Right now, we only permit a single public folder - I think this would
require multiple public folders.
One workaround you can do right now is to have your public folder
essentially just "alias" things in your other folders. So instead of
defining the whole thing in your public folder, just creating a public
constant that wraps the service or concern. It's a bit of extra boiler
plate but otherwise should solve it for you.
Long term, we've thought ideally that we could allow something to be
public with a comment at the top of the file. This would give full
flexibility to define what's public.
Let me know what ya think!
—
Reply to this email directly, view it on GitHub
<#34 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFOXORLLH4SDYPQ3QIWA73DX2WUBZANCNFSM6AAAAAA42OH5DQ>
.
You are receiving this because you were mentioned.Message ID:
<rubyatscale/packwerk-extensions/repo-discussions/34/comments/7021715@
github.com>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
To better fit within a typical rails folder structure I feel like there is benefit to allowing the public folder to be the root module within a package. So rather than
app/publicbeing the required place for public interfaces, it could help to keep code in the expected place within a rails application if instead the constant was expected to be placed in aPublic::namespace. So taking a typical app/engine folder structure:There is a concern (
Public::Publicity) and a service (Public::Open) that are publically available. This feels like it would allow for a more typical rails convention while still nicely enforcing the boundaries between packages.Beta Was this translation helpful? Give feedback.
All reactions