Skip to content

code organization for larger projects #1207

Answered by jkimbo
Tushant asked this question in Q&A
Discussion options

You must be logged in to vote

@Tushant for mutations at least (though it would work for Query as well) I tend to use the create_type tool: https://strawberry.rocks/docs/guides/tools#create_type

For example I have a file api/mutation.py which looks like this:

from strawberry.tools import create_type

from .mutations.create_product import create_product
from .mutations.add_review import add_review

Mutation = create_type(
	"Mutation",
	[
		create_product,
		add_review,
	]
)

You can imagine how that might work across multiple folders which each folder exporting a list of mutations and a central file merging them all together. One benefit of this approach is that you can pre-process your list of mutations and make sure th…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by Tushant
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@patrick91
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants