Replies: 1 comment 1 reply
-
Thank you for the feedback! It seems a lot of what you find surprising in Goa is probably due to a couple of fundamental different requirements that Python/FastAPI and Go/Goa are satisfying:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
For me, goa is the third - party library that comes closest to my ideal of code - first design. It uses DSL to define interfaces and I can design more advanced APIs based on this DSL to simplify API definitions. These designs are very ingenious.
Let me first provide some background. Currently, I'm migrating a Python project written with FastAPI to the Go language. Since FastAPI also adheres to the code - first concept, goa is almost my only choice. Other similar tools like huma don't seem to be fully mature yet. The overall migration process has been smooth, but there are still some design aspects that puzzle me.
Query()
,Param()
,Body()
, andHeader()
to categorize and handle these parameters separately, which significantly reduces the workload. Not to mention that goa doesn't support the declaration of object - type query parameters.Attribute
andMeta("struct:field:type"... )
. However, when I want to use this type in a scenario where both path parameters and the request body are involved, the generated code has a syntax error: I'm trying to assign a string type to my custom type. After checking the documentation, I found that when both the body and path parameters are present, path parameters must be of primitive types...As I progress deeper into the migration, I'm increasingly feeling like I'm "fighting with goa." I have to resort to all sorts of hacky ways to achieve my requirements.
So, I'd like to ask if there are more elegant solutions to the problems I mentioned above. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions