File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
openapi-processor-core/src/main/kotlin/io/openapiprocessor/core/converter Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ class DataTypeConverter(
135
135
)
136
136
137
137
items.forEach {
138
- (it as ModelDataType ).implementsDataType = objectType
138
+ (it as ModelDataType ).addInterface( objectType)
139
139
}
140
140
141
141
objectType
@@ -226,6 +226,11 @@ class DataTypeConverter(
226
226
}
227
227
228
228
dataTypes.add (schemaInfo.getName(), objectType)
229
+
230
+ if (schemaInfo.withInterface()) {
231
+ return createInterface(schemaInfo, objectType, dataTypes)
232
+ }
233
+
229
234
return objectType
230
235
}
231
236
Original file line number Diff line number Diff line change @@ -45,7 +45,17 @@ open class SchemaInfo(
45
45
/* *
46
46
* json path like location
47
47
*/
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
49
59
50
60
): MappingSchema {
51
61
@@ -64,6 +74,10 @@ open class SchemaInfo(
64
74
*/
65
75
private var refName: Boolean = false
66
76
77
+ fun withInterface (): Boolean {
78
+ return location == " response" && contentTypeInterface
79
+ }
80
+
67
81
override fun getPath (): String {
68
82
return endpoint.path
69
83
}
@@ -299,7 +313,12 @@ open class SchemaInfo(
299
313
endpoint = endpoint,
300
314
name = resolvedName,
301
315
schema = resolved.schema,
302
- resolver = resolver)
316
+ resolver = resolver,
317
+ location = location,
318
+ contentType = contentType,
319
+ contentTypeInterface = contentTypeInterface,
320
+ contentTypeInterfaceName = contentTypeInterfaceName
321
+ )
303
322
304
323
info.refName = true
305
324
You can’t perform that action at this time.
0 commit comments