Skip to content

Commit

Permalink
fix(showdoc): repair showdoc openapi compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lkqm committed Aug 2, 2022
1 parent dd5ce6d commit 35245d8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/main/java/io/yapix/base/sdk/showdoc/ShowdocClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import io.yapix.base.sdk.showdoc.model.AuthCookies;
import io.yapix.base.sdk.showdoc.model.CaptchaResponse;
import io.yapix.base.sdk.showdoc.model.LoginRequest;
Expand Down Expand Up @@ -147,7 +148,11 @@ public ShowdocProjectToken getProjectToken(String projectId) {
*/
public ShowdocUpdateResponse updatePageByOpenApi(ShowdocUpdateRequest request) {
String json = requestPost(ShowdocConstants.UpdatePageOpenApi, request);
return gson.fromJson(json, ShowdocUpdateResponse.class);
try {
return gson.fromJson(json, ShowdocUpdateResponse.class);
} catch (JsonSyntaxException e) {
return null;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ public ShowdocUpdateResponse upload(String projectId, Api api) {
page.setPageTitle(api.getSummary());
page.setPageContent(markdown);

return client.updatePageByOpenApi(page);
ShowdocUpdateResponse response = client.updatePageByOpenApi(page);
if (response == null) {
response = new ShowdocUpdateResponse();
response.setItemId(projectId);
}
return response;
}

private ShowdocProjectToken getToken(String projectId) {
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,10 @@

<change-notes><![CDATA[
0.9.6: <br>
- feat: 支持自定义@RequestBody注解<br>
- fix: 修复无法上传Eolinker问题<br>
- fix: 修复枚举类型列表文档无法解析<br>
- feat: 支持自定义@RequestBody注解<br>
- fix: 修复上传showdoc提示报错<br>
<br>
0.9.5: <br>
- fix: 修复插件兼容性,支持IDEA 2022.2<br>
Expand Down

0 comments on commit 35245d8

Please sign in to comment.