-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from softwaremill/pr-for-review
Revert "remove everything"
- Loading branch information
Showing
7 changed files
with
751 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# sttp-openapi example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name := "sttp-openapi-generator-example" | ||
|
||
version := "0.1" | ||
|
||
scalaVersion := "2.13.2" | ||
|
||
lazy val petstoreApi: Project = project | ||
.in(file("petstore-api")) | ||
.settings( | ||
openApiInputSpec := s"${baseDirectory.value.getPath}/petstore.yaml", | ||
openApiGeneratorName := "scala-sttp", | ||
//We can't use src_managed because there is no option to tell openapi-generator to generate files into different folder than src | ||
//see https://github.com/OpenAPITools/openapi-generator/issues/6685 for more details | ||
openApiOutputDir := baseDirectory.value.name, | ||
//Below setting is needed to configure generator not to generate other files besides src/main/scala | ||
openApiIgnoreFileOverride := s"${baseDirectory.in(ThisBuild).value.getPath}/openapi-ignore-file", | ||
libraryDependencies ++= Seq( | ||
"com.softwaremill.sttp.client" %% "core" % "2.2.0", | ||
"com.softwaremill.sttp.client" %% "json4s" % "2.2.0", | ||
"org.json4s" %% "json4s-jackson" % "3.6.8" | ||
), | ||
//We can't use sourceGenerators because this requires all files to compile and openapi-generator generates | ||
//some additional metadata files which breaks compilation. | ||
//see https://github.com/OpenAPITools/openapi-generator/issues/6685 for more details | ||
(compile in Compile) := ((compile in Compile) dependsOn openApiGenerate).value, | ||
//As we don't generate files into src_managed we have to do cleaning by our own | ||
cleanFiles += baseDirectory.value / "src" | ||
) | ||
|
||
lazy val core = project | ||
.in(file("core")) | ||
.dependsOn(petstoreApi) | ||
|
||
lazy val rootProject = project | ||
.in(file(".")) | ||
.aggregate(petstoreApi, core) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package sttp.example | ||
|
||
import org.openapitools.client.api.StoreApi | ||
import org.openapitools.client.core.{ApiKeyValue, SttpSerializer} | ||
import sttp.client.HttpURLConnectionBackend | ||
|
||
object Main { | ||
def main(args: Array[String]): Unit = { | ||
implicit val serializer: SttpSerializer = new SttpSerializer() | ||
implicit val apiKeyValue = ApiKeyValue("") | ||
implicit val backend = HttpURLConnectionBackend() | ||
println(StoreApi().getInventory().send()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* | ||
**/* | ||
!**/src/main/scala/**/* |
Oops, something went wrong.