wujimin commented on a change in pull request #1250: [SCB-1336][WIP][WEAK]
should not lost @ApiParam description when wrap parameter to body at swagger
generator pojo mode
URL:
https://github.com/apache/servicecomb-java-chassis/pull/1250#discussion_r298862801
##########
File path:
swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/pojo/PojoOperationGenerator.java
##########
@@ -83,9 +83,14 @@ private void wrapParametersToBody(List<ParameterGenerator>
bodyFields) {
bodyModel = new ModelImpl();
bodyModel.setType(ModelImpl.OBJECT);
for (ParameterGenerator parameterGenerator : bodyFields) {
- SwaggerUtils.addDefinitions(swagger,
parameterGenerator.getGenericType());
+ parameterGenerator.setHttpParameterType(HttpParameterType.BODY);
+ scanMethodParameter(parameterGenerator);
+
Property property =
ModelConverters.getInstance().readAsProperty(parameterGenerator.getGenericType());
+
property.setDescription(parameterGenerator.getGeneratedParameter().getDescription());
bodyModel.addProperty(parameterGenerator.getParameterName(), property);
+
+ parameterGenerator.setHttpParameterType(null);
Review comment:
yes
should not keep as "BODY", that will cause multiple bodies
no way to let swagger read ApiParam value, except we copy related logic
i will add some comment for this special logic.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services