Skip to content

Commit a3f14c3

Browse files
committed
Comments are not picked up for fields in Typed data classes. Fixes #1339
1 parent 231db66 commit a3f14c3

File tree

7 files changed

+33
-17
lines changed

7 files changed

+33
-17
lines changed

springdoc-openapi-javadoc/src/main/java/org/springdoc/openapi/javadoc/JavadocPropertyCustomizer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public Schema resolve(AnnotatedType type, ModelConverterContext context, Iterato
7575
List<Field> fields = FieldUtils.getAllFieldsList(cls);
7676
if (!CollectionUtils.isEmpty(fields)) {
7777
if (!type.isSchemaProperty()) {
78-
Schema existingSchema = context.getDefinedModels().get((cls).getSimpleName());
78+
Schema existingSchema = context.resolve(type);
7979
setJavadocDescription(fields, existingSchema);
8080
}
8181
else if (resolvedSchema.get$ref() != null && resolvedSchema.get$ref().contains(AnnotationsUtils.COMPONENTS_REF)) {

springdoc-openapi-javadoc/src/test/resources/results/app108.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,29 @@
4848
"ActionResultVoid": {
4949
"type": "object",
5050
"properties": {
51-
"value": {
52-
"type": "object"
53-
},
54-
"success": {
55-
"type": "boolean"
56-
},
5751
"errorCode": {
58-
"type": "string"
52+
"type": "string",
53+
"description": "The Error code."
54+
},
55+
"errorValue": {
56+
"type": "object",
57+
"description": "The Error value."
5958
},
6059
"message": {
61-
"type": "string"
60+
"type": "string",
61+
"description": "The Message."
6262
},
63-
"errorValue": {
64-
"type": "object"
63+
"success": {
64+
"type": "boolean",
65+
"description": "The Success."
6566
},
6667
"targetUrl": {
67-
"type": "string"
68+
"type": "string",
69+
"description": "The Target url."
70+
},
71+
"value": {
72+
"type": "object",
73+
"description": "The Value."
6874
}
6975
}
7076
}

springdoc-openapi-javadoc/src/test/resources/results/app122.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
"type": "object",
6565
"properties": {
6666
"wrapper": {
67-
"type": "string"
67+
"type": "string",
68+
"description": "The Wrapper."
6869
}
6970
}
7071
}

springdoc-openapi-javadoc/src/test/resources/results/app129.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
"type": "object",
7676
"properties": {
7777
"operationResult": {
78-
"type": "string"
78+
"type": "string",
79+
"description": "The Operation result."
7980
}
8081
}
8182
}

springdoc-openapi-javadoc/src/test/resources/results/app159.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"properties": {
7777
"code": {
7878
"type": "integer",
79+
"description": "The Code.",
7980
"format": "int32"
8081
}
8182
}
@@ -85,10 +86,12 @@
8586
"properties": {
8687
"code": {
8788
"type": "integer",
89+
"description": "The Code.",
8890
"format": "int32"
8991
},
9092
"message": {
91-
"type": "string"
93+
"type": "string",
94+
"description": "The Message."
9295
}
9396
}
9497
}

springdoc-openapi-javadoc/src/test/resources/results/app4.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,12 @@
5555
"properties": {
5656
"trackerId": {
5757
"type": "string",
58+
"description": "The Tracker id.",
5859
"example": "the-tracker-id"
5960
},
6061
"timestamp": {
6162
"type": "string",
63+
"description": "The Timestamp.",
6264
"format": "date-time",
6365
"example": "2018-01-01T00:00:00Z"
6466
},

springdoc-openapi-javadoc/src/test/resources/results/app54.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,21 @@
115115
"type": "object",
116116
"properties": {
117117
"name": {
118-
"type": "string"
118+
"type": "string",
119+
"description": "The Name."
119120
}
120121
}
121122
},
122123
"MealParty_MealPartyAdmin": {
123124
"type": "object",
124125
"properties": {
125126
"name": {
126-
"type": "string"
127+
"type": "string",
128+
"description": "The Name."
127129
},
128130
"members": {
129131
"type": "array",
132+
"description": "The Members.",
130133
"items": {
131134
"type": "string"
132135
}

0 commit comments

Comments
 (0)