smithy4s icon indicating copy to clipboard operation
smithy4s copied to clipboard

Documentation: simpleRestJson add http method / path to scaladoc on service

Open daddykotex opened this issue 2 years ago • 2 comments

Title says it all but basically: it's not the first time I work in a project where the specification is pulled from somewhere by the build tool. Some code is generated from it and I am implementing the service, and I run it to test it. But sometimes I forget what's the path to reach the specific operation.

Would adding something like the following be interesting:

// this is generated code
package thingy

// imports omitted

trait MyServiceGen[F[_, _, _, _, _]] {
  self =>

  /**
   * Method: GET
   * Path: /health_check
  */
  def getHealth(): F[Unit, MyServiceGen.GetHealthError, HealthResponse, Nothing, Nothing]

  def transform: Transformation.PartiallyApplied[MyServiceGen[F]] = Transformation.of[MyServiceGen[F]](this)
}
// ... rest is omitted

That would make it easier to figure out by using the IDE go-to-definition feature and ending up in the codegen where you find the info. You still don't have all the info, but sometimes that's all you need.

daddykotex avatar Jan 13 '23 21:01 daddykotex

I like the idea, but that will require protocol-specific handling in the codegen I think. It's probably not a huge problem though, IIRC the decline module does something similar, and so does smithy-playground.

kubukoz avatar Jan 13 '23 22:01 kubukoz

I like the idea, but that will require protocol-specific handling in the codegen I think

I think I'm fine with it because it's not adding any protocol specific logic to the generated code

Baccata avatar Jan 14 '23 08:01 Baccata