in common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java [93:132]
public void init(OperationMeta operationMeta) {
this.operationMeta = operationMeta;
OpenAPI swagger = operationMeta.getSchemaMeta().getSwagger();
Operation operation = operationMeta.getSwaggerOperation();
this.produces =
(operation.getResponses().get(SwaggerConst.SUCCESS_KEY) == null ||
operation.getResponses().get(SwaggerConst.SUCCESS_KEY).getContent() == null) ?
null : operation.getResponses().get(SwaggerConst.SUCCESS_KEY).getContent().keySet().stream().toList();
this.downloadFile = checkDownloadFileFlag();
this.createProduceProcessors();
if (operation.getParameters() != null) {
for (int swaggerParameterIdx = 0; swaggerParameterIdx < operation.getParameters().size(); swaggerParameterIdx++) {
Parameter parameter = operation.getParameters().get(swaggerParameterIdx);
Type type = operationMeta.getSwaggerProducerOperation() != null ? operationMeta.getSwaggerProducerOperation()
.getSwaggerParameterTypes().get(parameter.getName()) : null;
RestParam param = new RestParam(parameter, type);
addParam(param);
}
}
if (operation.getRequestBody() != null) {
if (isFormParameters(operation)) {
formData = true;
Schema formSchema = formSchemas(operation);
if (formSchema != null) {
formSchema.getProperties().forEach((k, v) -> {
addRestParamByName(operationMeta, (String) k, operation);
});
}
} else {
addRestParamByName(operationMeta,
(String) operation.getRequestBody().getExtensions().get(SwaggerConst.EXT_BODY_NAME), operation);
}
}
setAbsolutePath(concatPath(SwaggerUtils.getBasePath(swagger), operationMeta.getOperationPath()));
}