Closed FreekingDean closed 4 years ago
Hey @FreekingDean, thanks for this! I'd not seen #31 (2014, eesh!).
I've seen other code generators (particularly gRPC) add issues like this by injecting something that does use the import but throws it away, like var _ = time.Second
. What do you think about having schematic do the same? Looks like it could perhaps go at the end of imports.tmpl
?
Hello! Sorry for the delay. That seems like something that would totally solve the problem in a much simpler way. :)
@FreekingDean looks like it also needed a go generate
after updating the template, which I've pushed up. I verified that the generated code for the heroku schema still compiles correctly and now includes the time
usage, so this looks good. Thanks for your contribution!
fixes #31
Its not an insanely elegant solution and doesn't cover every case (ex, a link targetSchema/Schema with custom properties requiring time), but it seems to do the trick!
I think if instead we do a 2 pass evaluation on the schema we could know better ahead of time if it is fully required or not.