Skip to content

Commit

Permalink
fix: strip forward slash in description
Browse files Browse the repository at this point in the history
  • Loading branch information
brizzbuzz committed Jul 27, 2024
1 parent 0760f68 commit 90c4351
Show file tree
Hide file tree
Showing 5 changed files with 4,783 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class RequestGenerator(

receiver(HttpClient::class)
addModifiers(KModifier.SUSPEND)
description?.let { addKdoc("%L", it) }
description?.let { addKdoc("%L", it.replace("/", "")) }
addTypeHints(this@createRequestFunction)
attachParameters(this@createRequestFunction, pathItem.parameters?.toList() ?: emptyList())
val ktorMember = method.toKtorMemberName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class OpenApiClientGeneratorTest : DescribeSpec({
// Assert
files shouldHaveSize 181
}
it("Can generate the client for the FactSet Prices API") {
// Act
val files = ApiClientGenerator.generate(getFileUrl("factset-prices.yml"), "com.factset.client")

// Assert
files shouldHaveSize 93
}
}
describe("Code Compilation") {
it("Can compile the client code for the Neon API") {
Expand Down Expand Up @@ -73,6 +80,44 @@ class OpenApiClientGeneratorTest : DescribeSpec({
// Act
val result = compilation.compile()

// Assert
result.exitCode shouldBe KotlinCompilation.ExitCode.OK
}
it("Can compile the client code for the FactSet Prices API") {
// Arrange
val tempDir = createTempDirectory()
val files = ApiClientGenerator.generate(getFileUrl("factset-prices.yml"), "com.factset.client")
files.forEach { it.writeTo(tempDir) }
val sourceFiles = tempDir.walk().filter { it.isRegularFile() }.map { SourceFile.fromPath(it.toFile()) }.toList()
val compilation = KotlinCompilation().apply {
sources = sourceFiles
inheritClassPath = true
messageOutputStream = System.out
workingDir = tempDir.toFile()
}

// Act
val result = compilation.compile()

// Assert
result.exitCode shouldBe KotlinCompilation.ExitCode.OK
}
it("Can compile the client code for the Alpaca Broker API") {
// Arrange
val tempDir = createTempDirectory()
val files = ApiClientGenerator.generate(getFileUrl("alpaca-broker.yml"), "com.alpaca.client")
files.forEach { it.writeTo(tempDir) }
val sourceFiles = tempDir.walk().filter { it.isRegularFile() }.map { SourceFile.fromPath(it.toFile()) }.toList()
val compilation = KotlinCompilation().apply {
sources = sourceFiles
inheritClassPath = true
messageOutputStream = System.out
workingDir = tempDir.toFile()
}

// Act
val result = compilation.compile()

// Assert
result.exitCode shouldBe KotlinCompilation.ExitCode.OK
}
Expand Down
Loading

0 comments on commit 90c4351

Please sign in to comment.