Skip to content

Commit

Permalink
Add api module which uses smithy
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh committed May 8, 2024
1 parent 8e074b4 commit 39d9464
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ lazy val play = project
).dependsOn(core)


lazy val api = (project in file("modules/api"))
.enablePlugins(Smithy4sCodegenPlugin)
.settings(
name := "api",
libraryDependencies ++= Seq(
"com.disneystreaming.smithy4s" %% "smithy4s-core" % smithy4sVersion.value,
)
)

lazy val root = project
.in(file("."))
.aggregate(core, play)

.aggregate(core, play, api)
27 changes: 27 additions & 0 deletions modules/api/src/main/smithy/health.smithy
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
$version: "2"

namespace lila.search.spec

use alloy#simpleRestJson

@simpleRestJson
service HealthService {
version: "3.0.0",
operations: [HealthCheck]
}

@readonly
@http(method: "GET", uri: "/health", code: 200)
operation HealthCheck {
output: HealthStatusOutput
}

enum ElasticStatus {
Ok = "ok"
Unreachable = "unreachable"
}

structure HealthStatusOutput {
@required
elastic: ElasticStatus
}
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
addSbtPlugin("com.disneystreaming.smithy4s" % "smithy4s-sbt-codegen" % "0.18.16")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.5.1")
Expand Down
16 changes: 16 additions & 0 deletions smithy-build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "1.0",
"maven": {
"dependencies": [
"com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15",
"com.disneystreaming.alloy:alloy-core:0.1.21",
"com.disneystreaming.alloy:alloy-core:0.3.4"
],
"repositories": []
},
"imports": [
"./src",
"modules/smithy/src/main/smithy",
"modules/smithy/target/scala-3.4.1/src_managed/main/smithy"
]
}

0 comments on commit 39d9464

Please sign in to comment.