Skip to content

Commit 511349d

Browse files
committed
今天和这个测试用例刚上了
1 parent 8187a35 commit 511349d

File tree

2 files changed

+3
-52
lines changed

2 files changed

+3
-52
lines changed

apidoc-core/src/main/java/com/ztianzeng/apidoc/ModelResolver.java

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public Schema resolve(AnnotatedType annotatedType,
169169
if (DocUtils.isPrimitive(field.getName())) {
170170
continue;
171171
}
172-
JavaClass type = genericityContentType(targetClass) == null ? field.getType() : genericityContentType(targetClass);
172+
JavaClass type = field.getType();
173173

174174
AnnotatedType aType = new AnnotatedType()
175175
.javaClass(type)
@@ -218,32 +218,6 @@ public Schema resolve(AnnotatedType annotatedType,
218218
return schema;
219219
}
220220

221-
/**
222-
* 设置泛型
223-
*
224-
* @param type
225-
* @param schema
226-
* @param annotatedType
227-
* @param targetClass
228-
* @param context
229-
*/
230-
public void setRefType(JavaClass type, Schema schema, AnnotatedType annotatedType, JavaClass targetClass, ModelConverterContext context) {
231-
List<JavaType> ref = ((DefaultJavaParameterizedType) type).getActualTypeArguments();
232-
if (!ref.isEmpty()) {
233-
for (JavaType actualTypeArgument : ref) {
234-
AnnotatedType aType = new AnnotatedType()
235-
.javaClass((DefaultJavaParameterizedType) actualTypeArgument)
236-
.parent(schema)
237-
.resolveAsRef(annotatedType.isResolveAsRef())
238-
.jsonViewAnnotation(annotatedType.getJsonViewAnnotation())
239-
.skipSchemaName(true)
240-
.schemaProperty(true)
241-
.propertyName(targetClass.getName());
242-
context.resolve(aType);
243-
}
244-
}
245-
}
246-
247221
/**
248222
* 设置泛型
249223
*

apidoc-core/src/test/java/com/ztianzeng/apidoc/test/ReaderTest.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -204,37 +204,14 @@ public void testMuRet() {
204204
" msg:\n" +
205205
" type: string\n" +
206206
" data:\n" +
207-
" required:\n" +
208-
" - username\n" +
209-
" type: object\n" +
210-
" properties:\n" +
211-
" username:\n" +
212-
" type: string\n" +
213-
" description: 用户名\n" +
214-
" mobile:\n" +
215-
" type: string\n" +
216-
" description: 手机\n" +
207+
" $ref: '#/components/schemas/CreateParam'\n" +
217208
" ResultResult2CreateParam:\n" +
218209
" type: object\n" +
219210
" properties:\n" +
220211
" msg:\n" +
221212
" type: string\n" +
222213
" data:\n" +
223-
" type: object\n" +
224-
" properties:\n" +
225-
" msg:\n" +
226-
" type: string\n" +
227-
" data:\n" +
228-
" required:\n" +
229-
" - username\n" +
230-
" type: object\n" +
231-
" properties:\n" +
232-
" username:\n" +
233-
" type: string\n" +
234-
" description: 用户名\n" +
235-
" mobile:\n" +
236-
" type: string\n" +
237-
" description: 手机\n";
214+
" $ref: '#/components/schemas/Result2CreateParam'\n";
238215

239216
SerializationMatchers.assertEqualsToYaml(openAPI, yaml);
240217
}

0 commit comments

Comments
 (0)