Replies: 1 comment
-
|
PR #696 should solve this problem. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I noticed that ogen will use mixed receivers for the generated type methods. This is problematic, especially when using default response for errors.
If default response for errors is used, the handler interface will return a non pointer struct.
This is problematic since this makes it impossible to do anything useful with the response in middleware. For one, it is hard to check if the type satisfies some interface since the methods have mixed receivers and all the setters have pointer receiver. And second, even if you can find out that the response implements a given setter interface, you would mutate a copy of the response in the middleware.
Hence, I think types should have generally pointer receiver for all methods and get passed around as pointer.
Beta Was this translation helpful? Give feedback.
All reactions