HttpClient[F], by way of
FooClient.httpClient[F[_]](httpClient: Http4sClient[F], host: String = "http://localhost:1234")(implicit F: Async[F]): FooClient[F]
= Nonedefault values for optional values?
@lolgab Pardon for the delay in response! I must have missed the notification.
This isn't currently configurable, though I'm curious about your use case. Would you want to disable this in all cases, in order to make it obvious where the code needs to change if a spec changes?
The location where those
None values are interpolated is here
project/src/main/scala/dev/guardrail/CirceOverrides.scala. I'm trying to get that wrapped up soon, life has been getting in the way a bit 😅
Would you want to disable this in all cases, in order to make it obvious where the code needs to change if a spec changes?
Yes, I try to avoid default parameters since I always forget to propagate some of them and end up creating bugs.
I check if I can define that override myself, thank you very much :)
spibranch in the next few weeks, if you don't mind waiting; I can provide a working example of what you're trying to do once it's done
martijn.hoekstra.zivver: It's an unfortunate state of the MiMa checker -- I'm changing how the module system works, building towards a new minor release, but the build fails unless there's the GitHub
minor tag present in the build event...
I was thinking of trying to use the GitHub API to collect the semver tags of merged PRs, though maybe as a stopgap just disabling MiMa checking on
master would be acceptable
sample-sbt-http4srepo where it is used.
*Generatorclasses has a
.copymethod that takes all parameters, so you can just open a file, copy the entire function you want to modify, then modify and re-inject it via https://github.com/guardrail-dev/guardrail-sample-sbt-http4s/blob/a3c270dc2ef340ed7f980b6e866c9c1d2cafb3b4/custom-circe/src/main/scala/CustomCirce.scala#L120-L122
Latest version of guardrail published to coursier contrib apps,
cs install --contrib guardrail
to get the CLI runner
Thanks to @stanislav-chetvertkov for adding support for
refined to the circe generator! guardrail-dev/guardrail#1508 is merged, to be released shortly.
For those interested in trying it out, you can use
modules=Seq("http4s", "circe-refined") or
modules=Seq("akka-http", "circe-refined") in your sbt-guardrail configuration
I have a question about default values..
If I have a query parameter with:
required: false default = 100
limit: Option[Int] = Option(100) where I wanted it to generate
limit: Int = 100.
Is that possible?
I tried with:
required: true default = 100
and it seems to generate what I want, but it is not what the spec says to do, in fact it is in the "Common Mistakes"
None, which violates the
MUSTin the specification, but there are no other implications
required: falseit generates an
Optionwhile if you do use
required: trueit seems to do what I want
required: true, and eventually the
required: falseconstruction will also generate the same signature.