-
Notifications
You must be signed in to change notification settings - Fork 420
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
Make types public #1180
base: master
Are you sure you want to change the base?
Make types public #1180
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an integration test to make sure we don't break this in the future? Can you also add to the docs that these public types are experimental and not to be relied on, linking back to the issue? Thanks!
@LegNeato I'll look at this next week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tusharmath the proposed changes are quite controversial. Overall, I'm not a fan of them.
Could you show a code that requires these changes to achieve what you want? Having it, it would be better to come up with the solution that satisfies both of us.
@@ -6,7 +6,7 @@ use std::{ | |||
}; | |||
|
|||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] | |||
pub struct Name(String); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tusharmath I don't like this change, because it breaks encapsulation for the Name
type here and allow freely bypass its invariants. It's far better here to provide a meaningful constructor-function, which checks the invariants.
@@ -33,8 +33,8 @@ mod ast; | |||
pub mod executor; | |||
mod introspection; | |||
pub mod parser; | |||
pub(crate) mod schema; | |||
mod types; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tusharmath here types are mostly re-exported to the crate's root. If something is missing, I think it's better to add that to the re-exports, rather than making these modules public.
Types can be used to generate a RootNode dynamically. This is a quick fix for #1117.
if this looks good, I can create a few more PRs that make some of the internal types public, allows developers to create RootNode and Schema using techniques other than Macros.