All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smithy4s.com.dwolla.consul.smithy.Discoverable.scala Maven / Gradle / Ivy

Go to download

smithy4s middleware to rewrite URLs back to the consul://{service} format expected by http4s-consul-middleware

There is a newer version: 0.3.3
Show 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))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy