Skip to content

Support fragments in interfaces #153

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

Merged
merged 4 commits into from
Sep 30, 2018
Merged

Support fragments in interfaces #153

merged 4 commits into from
Sep 30, 2018

Conversation

tomhoule
Copy link
Member

No description provided.

@tomhoule tomhoule changed the title Support fragments in interfaces WIP - Support fragments in interfaces Sep 28, 2018
@tomhoule tomhoule changed the title WIP - Support fragments in interfaces Support fragments in interfaces Sep 29, 2018
@tomhoule tomhoule force-pushed the fragments-in-interfaces branch 3 times, most recently from fec1d6b to e4d2ff1 Compare September 29, 2018 19:18
@tomhoule
Copy link
Member Author

@h-michael tagging you in case you want to review this (no obligation of course).

iface.field_impls_for_selection(context, &self.selection, &self.name)?;
let fields =
iface.response_fields_for_selection(context, &self.selection, &self.name)?;
(field_impls, fields)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code isn't pretty, we could make it a trait. On the other hand we have to support type-refining fragments so it may not be the right time to abstract more.

}

type InterfaceQuery {
everything: [Named!]
everything: [Named!]
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, I wonder if it's .editorconfig.

@tomhoule tomhoule force-pushed the fragments-in-interfaces branch 2 times, most recently from 4ab0429 to 2b1ce4f Compare September 29, 2018 19:50
This is limited to the interface’s own fields for now. We do not support type-refining fragments (see this issue: #154).
It fixes a panic on previous versions in some cases when multiple fields in a struct are marked with #[flatten]. We do that in interfaces.
Also enable #[deny(missing_docs)] on the codegen crate.
@tomhoule tomhoule force-pushed the fragments-in-interfaces branch from 2b1ce4f to a05f0b5 Compare September 29, 2018 20:17
Copy link
Member

@h-michael h-michael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
And it works when I tried use fragments for interface that is in my project. 🎉

@tomhoule
Copy link
Member Author

Great, thanks :) It's the last thing I wanted in for the 0.5 release, so it's happening soon!

@tomhoule tomhoule merged commit 09e32d0 into master Sep 30, 2018
@tomhoule tomhoule deleted the fragments-in-interfaces branch September 30, 2018 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants