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

Trim down prefixing of generated items #80

Closed
tomhoule opened this issue Aug 12, 2018 · 4 comments
Closed

Trim down prefixing of generated items #80

tomhoule opened this issue Aug 12, 2018 · 4 comments
Milestone

Comments

@tomhoule
Copy link
Member

We don't need the Rust prefix, probably

@tomhoule tomhoule changed the title Trim down prefixing Trim down prefixing of generated items Aug 12, 2018
@LegNeato
Copy link
Member

Should we do no prefix by default and let the user configure it?

@tomhoule
Copy link
Member Author

That's the safest option probably, although  I don't see a use-case for prefixing happening often anymore, since, if my memory is right, we already prefix the generated items with the query name, in addition to wrapping everything in a module. For example:

query People {
  person(id: 1) { name }
}

Will generate a struct called RustPeoplePerson. Fragments are also their own "roots". So collisions can happen but should be rare, so we could probably do custom prefixing, defaulting to nothing.

Example query that should collide with the generated ResponseData without prefixing, for testing purposes:

query Response {
  data
}

@LegNeato
Copy link
Member

LegNeato commented Aug 28, 2018

I was thinking, does ResponseData even need to be generated? Would it make sense to have another struct you annotate with #[derive(GraphQLResponse)like GraphQLQuery? Does that buy us anything?

@tomhoule tomhoule added this to the 0.7.0 milestone Nov 4, 2018
@tomhoule
Copy link
Member Author

tomhoule commented Nov 4, 2018

Hmm, sorry for reacting to your last comment that late. Since a given ResponseData's fields are specific to one query, I don't think there is a way around generating it. I am not sure I understand entirely.

tomhoule added a commit that referenced this issue Nov 11, 2018
Remove the "Rust" prefix from generated items (closes #80)
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

No branches or pull requests

2 participants