Open erichartline opened 5 years ago
After further review, yes we should use custom models. This will enable us to only create resolvers for what is actually needed and it will remove a lot of redundant code. See the latest models used for Strain
and Plasmid
for examples on how to do so.
Models:
Steps to implement:
1) Add new file in models
package with your custom models.
2) Update gqlgen.yml
to point at the new model and specify any resolvers that need to be handled individually. For now, this would likely only be certain stock fields that retrieve data from annotations, not stock db.
3) Run script -- go generate ./...
4) Check diff of genresolver.go
and make note of the methods that were removed. Now go to individual resolver file, i.e. resolver/order/order.go
and remove those same resolvers.
5) Run unit tests and build the application to check for anything else that might need to be changed for the new models.
For strain and plasmid, we had to create our own custom models rather than just pointing them to the original protocol buffer
struct
. Should we update the other models to match this format, or should we leave them pointing directly at the protocol buffers?