-
Notifications
You must be signed in to change notification settings - Fork 93
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
Annotations need their own namespace #309
Comments
In order to reduce the duplication you could also make use of embedding:
but since api2go heavily relies on the json package internally, we cannot simply rename the json tags. I hope it helps :) |
If I'm not mistaken, that use of embedding causes the both the Etcd struct and the nested Api2go struct to both have a ForeignKey field, which gives rise to ambiguity, and duplication in initialization. Probably not worth it... |
Hmm, it might be that I misunderstood your question. Can you provide some code so we can talk about a specific implementation? Would make it easier :) |
@sharpner So in your example would you populate |
Well it's true that this approach contains a duplicate field, but then again the field should behave differently in two different use cases. Since for us, it's not feasible. to switch back from |
I store my [DTO's|https://en.wikipedia.org/wiki/Data_transfer_object] in etcd, and then serialize them via JSONAPI.
I've noticed that I'm accumulating duplicate DTO's - one for etcd storage, and one for api2go -- because they have different JSON serialization requirements.
This could be solved by using api2go's own model field annotations, instead of piggybacking on JSON serialization annotations.
The text was updated successfully, but these errors were encountered: