smithy4s.com.dwolla.consul.smithy.Discoverable.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smithy4s-consul-middleware_sjs1_3 Show documentation
Show all versions of smithy4s-consul-middleware_sjs1_3 Show documentation
smithy4s middleware to rewrite URLs back to the consul://{service} format expected by http4s-consul-middleware
The newest version!
package com.dwolla.consul.smithy
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.struct
final case class Discoverable(serviceName: ServiceName)
object Discoverable extends ShapeTag.Companion[Discoverable] {
val id: ShapeId = ShapeId("com.dwolla.consul.smithy", "discoverable")
val hints: Hints = Hints(
smithy.api.Trait(selector = Some(":is(service)"), structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
// constructor using the original order from the spec
private def make(serviceName: ServiceName): Discoverable = Discoverable(serviceName)
implicit val schema: Schema[Discoverable] = recursive(struct(
ServiceName.schema.required[Discoverable]("serviceName", _.serviceName),
)(make).withId(id).addHints(hints))
}