Open parafoxia opened 6 months ago
hi @parafoxia I think this is our fault in not documenting it well π
I made an example of operation directives: https://play.strawberry.rocks/?gist=30af63743c03d47044fe798240ca0f44
They are used when sending the operation :)
What are you trying to do exactly?
Ah thanks for that! I had no idea that playground existed haha.
Basically we're implementing a caching system. We're moving over from a solution on top of Ariadne to one in Strawberry, and caching was done as a directive previously. We have since stumbled across an example in the docs of caching being handled by a custom SchemaExtension
-- would you say that would be the best way forward?
@parafoxia Depending on your desired cache granularity, using FieldExtension
s for caching with a specified TTL for each field might also work well. At the other hand you can also specify a directive and read it using the schema extensions.
Cool, I'll have a look into all those possibilities. Thanks both of you for your responses! We're really liking Strawberry so far, can't wait for our whole system to be using it π
I'll leave this issue open for now in case there were any follow-ups you wanted to track using it (not sure if the docs feedback is tracked separately), but I'm happy on my end.
@parafoxia let us know how the migration goes (maybe on discord!) and let us know if there's anything we can help with π
Describe the Bug
This might be an accidental duplicate of #3125. It may also be me rather than the lib at fault as the documentation on Operation directives is very limited (already left feedback for that in the proper place).
It seems that the inclusion of a directive in...well, anything is enough to throw an error when exporting the schema.
MRE:
Passing the directive to
strawberry.type
forMessage
also triggers it. There's adirectives
argument toSchema
, but it's undocumented. It expectsSequence[Type]
, notably notSequence[StrawberryDirective]
-- is that in some way related to this problem?I'm guessing by the traceback below I'm not supposed be passing a
StrawberryDirective
though todirectives
, but if not, what?Traceback:
System Information
Additional Context
Upvote & Fund