File tree Expand file tree Collapse file tree
openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class DataTypeConverter(
135135 )
136136
137137 items.forEach {
138- (it as ModelDataType ).implementsDataType = objectType
138+ (it as ModelDataType ).addInterface( objectType)
139139 }
140140
141141 objectType
@@ -226,6 +226,11 @@ class DataTypeConverter(
226226 }
227227
228228 dataTypes.add (schemaInfo.getName(), objectType)
229+
230+ if (schemaInfo.withInterface()) {
231+ return createInterface(schemaInfo, objectType, dataTypes)
232+ }
233+
229234 return objectType
230235 }
231236
Original file line number Diff line number Diff line change @@ -45,7 +45,17 @@ open class SchemaInfo(
4545 /* *
4646 * json path like location
4747 */
48- private val location : String = " "
48+ private val location : String = " " ,
49+
50+ /* *
51+ * add content type interface
52+ */
53+ private val contentTypeInterface : Boolean = false ,
54+
55+ /* *
56+ * content type interface name.
57+ */
58+ private val contentTypeInterfaceName : String? = null
4959
5060): MappingSchema {
5161
@@ -64,6 +74,10 @@ open class SchemaInfo(
6474 */
6575 private var refName: Boolean = false
6676
77+ fun withInterface (): Boolean {
78+ return location == " response" && contentTypeInterface
79+ }
80+
6781 override fun getPath (): String {
6882 return endpoint.path
6983 }
@@ -299,7 +313,12 @@ open class SchemaInfo(
299313 endpoint = endpoint,
300314 name = resolvedName,
301315 schema = resolved.schema,
302- resolver = resolver)
316+ resolver = resolver,
317+ location = location,
318+ contentType = contentType,
319+ contentTypeInterface = contentTypeInterface,
320+ contentTypeInterfaceName = contentTypeInterfaceName
321+ )
303322
304323 info.refName = true
305324
You can’t perform that action at this time.
0 commit comments