fix 修复 openapi结构体 因springdoc缓存导致多次拼接接口路径问题

feature/model
疯狂的狮子li 2 years ago
parent 2f2021caaf
commit be37190c09

@ -95,10 +95,25 @@ public class SwaggerConfig {
// 对所有路径增加前置上下文路径 // 对所有路径增加前置上下文路径
return openApi -> { return openApi -> {
Paths oldPaths = openApi.getPaths(); Paths oldPaths = openApi.getPaths();
Paths newPaths = new Paths(); if (oldPaths instanceof PlusPaths) {
return;
}
PlusPaths newPaths = new PlusPaths();
oldPaths.forEach((k,v) -> newPaths.addPathItem(finalContextPath + k, v)); oldPaths.forEach((k,v) -> newPaths.addPathItem(finalContextPath + k, v));
openApi.setPaths(newPaths); openApi.setPaths(newPaths);
}; };
} }
/**
* 使便 springdoc
*
* @author Lion Li
*/
static class PlusPaths extends Paths {
public PlusPaths() {
super();
}
}
} }

Loading…
Cancel
Save