@@ -60,6 +60,15 @@ public Reader(OpenAPI openAPI) {
60
60
mapper = Json .mapper ();
61
61
}
62
62
63
+ public Reader (OpenAPI openAPI , SourceBuilder sourceBuilder ) {
64
+ this .openAPI = openAPI ;
65
+ paths = new Paths ();
66
+ components = new Components ();
67
+ this .sourceBuilder = sourceBuilder ;
68
+ this .builder = sourceBuilder .getBuilder ();
69
+ mapper = Json .mapper ();
70
+ }
71
+
63
72
/**
64
73
* 读取class的method
65
74
*
@@ -258,7 +267,7 @@ public Operation parseMethod(BeanDescription beanDesc, JavaMethod javaMethod, bo
258
267
.deprecated (deprecated )
259
268
.build ();
260
269
setDescAndSummary (build , javaMethod );
261
- if (tag != null ) {
270
+ if (StringUtils . isNotBlank ( tag ) ) {
262
271
build .addTagsItem (tag );
263
272
}
264
273
setParametersItem (build , javaMethod );
@@ -274,7 +283,9 @@ public Operation parseMethod(BeanDescription beanDesc, JavaMethod javaMethod, bo
274
283
}
275
284
}
276
285
277
- assert jackSonMethod != null ;
286
+ if (jackSonMethod == null ) {
287
+ return build ;
288
+ }
278
289
setRequestBody (build , javaMethod , jackSonMethod );
279
290
280
291
// 处理方法的信息
@@ -355,6 +366,9 @@ private void setParametersItem(Operation apiMethodDoc, JavaMethod method) {
355
366
for (String s : stringSchemaMap .keySet ()) {
356
367
Schema schema = stringSchemaMap .get (s );
357
368
Map <String , Schema > properties = schema .getProperties ();
369
+ if (properties == null ) {
370
+ continue ;
371
+ }
358
372
properties .forEach ((k , v ) -> {
359
373
Parameter inputParameter = new Parameter ();
360
374
inputParameter .setName (k );
0 commit comments