Skip to content

Commit 6d826aa

Browse files
committed
1 parent c737098 commit 6d826aa

File tree

2 files changed

+10
-2
lines changed
  • openapi-processor-core/src

2 files changed

+10
-2
lines changed

openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java/ApiWriter.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import io.openapiprocessor.core.writer.*
1515
import java.io.StringWriter
1616
import java.io.Writer
1717

18+
typealias AdditionalWriter = (ApiOptions, SourceFormatter, WriterFactory) -> Unit
19+
1820
/**
1921
* Root writer for the generated api files.
2022
*/
@@ -26,6 +28,7 @@ class ApiWriter(
2628
private val dataTypeWriter: DataTypeWriter,
2729
private val enumWriter: StringEnumWriter,
2830
private val interfaceDataTypeWriter: InterfaceDataTypeWriter,
31+
private val additionalWriter: List<AdditionalWriter> = emptyList(),
2932
private val formatter: SourceFormatter = GoogleFormatter(),
3033
private val writerFactory: WriterFactory = DefaultWriterFactory(options)
3134
) {
@@ -42,6 +45,7 @@ class ApiWriter(
4245
writeObjectDataTypes(api)
4346
writeInterfaceDataTypes(api)
4447
writeEnumDataTypes(api)
48+
writeAdditionalFiles()
4549
}
4650

4751
private fun writeGenerated () {

openapi-processor-core/src/testInt/kotlin/io/openapiprocessor/core/TestProcessor.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,15 @@ class TestProcessor:
4646
)
4747

4848
val generatedWriter = GeneratedWriterImpl(generatedInfo, options)
49+
val validationWriter = ValidationWriter(options)
4950
val beanValidation = BeanValidationFactory(options)
5051
val javaDocWriter = JavaDocWriter()
52+
val formatter = GoogleFormatter()
5153

5254
val writer = ApiWriter(
5355
options,
5456
generatedWriter,
55-
ValidationWriter(options),
57+
validationWriter,
5658
InterfaceWriter(
5759
options,
5860
generatedWriter,
@@ -86,7 +88,9 @@ class TestProcessor:
8688
options,
8789
generatedWriter,
8890
javaDocWriter
89-
)
91+
),
92+
listOf(),
93+
formatter
9094
)
9195

9296
writer.write(api)

0 commit comments

Comments
 (0)