Skip to content

Commit 4a55952

Browse files
committed
1 parent b58c666 commit 4a55952

File tree

1 file changed

+8
-2
lines changed
  • openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/writer/java

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,17 @@ class InterfaceWriter(
129129

130130
private fun addImports(endpoint: Endpoint, response: EndpointResponse, imports: MutableSet<String>) {
131131
val mappingFinder = MappingFinder(apiOptions)
132-
val resultStyle = mappingFinder.findResultStyleMapping(MappingFinderQuery(endpoint))
133-
val responseImports: MutableSet<String> = response.getResponseImports(resultStyle).toMutableSet()
132+
val query = MappingFinderQuery(endpoint)
133+
val resultStyle = mappingFinder.findResultStyleMapping(query)
134+
val resultStatus = mappingFinder.getResultStatusOption(query)
134135

136+
val responseImports: MutableSet<String> = response.getResponseImports(resultStyle).toMutableSet()
135137
if (responseImports.isNotEmpty()) {
136138
imports.addAll(responseImports)
137139
}
140+
141+
if (resultStatus && response.hasSingleResponse(resultStyle)) {
142+
imports.addAll(annotations.getAnnotation(response).imports)
143+
}
138144
}
139145
}

0 commit comments

Comments
 (0)