-
Notifications
You must be signed in to change notification settings - Fork 69
fix: Modify code format #268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReformatted Swagger/OpenAPI annotations across multiple controllers to standardize parameters and responses nesting and indentation. No changes to method signatures, mappings, return types, or logic. ResourceController includes a minor indentation adjustment without behavioral impact. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
base/src/main/java/com/tinyengine/it/controller/PageController.java (1)
154-176: Remove duplicate setter in updatePage.
page.setLastUpdatedTime(null);is called twice.Apply:
- page.setLastUpdatedTime(null); page.setLastUpdatedTime(null);
🧹 Nitpick comments (28)
base/src/main/java/com/tinyengine/it/controller/DataSourceController.java (1)
154-166: Use HTTP DELETE for delete endpoint.Current delete uses GET mapping; prefer DELETE for correctness and tooling compatibility.
Apply:
- @GetMapping("/sources/delete/{id}") + @DeleteMapping("/sources/delete/{id}")Ensure
org.springframework.web.bind.annotation.DeleteMappingis imported.base/src/main/java/com/tinyengine/it/controller/PageController.java (1)
164-166: Align mapping with path variable usage.Route contains
{id}but method doesn’t accept it; either remove{id}from path or accept and use the variable.Example fix:
- @PostMapping("/pages/update/{id}") - public Result<Page> updatePage(HttpServletRequest request) throws IOException { + @PostMapping("/pages/update/{id}") + public Result<Page> updatePage(@PathVariable Integer id, HttpServletRequest request) throws IOException { ... - Page page = JsonUtils.decode(json, Page.class); + Page page = JsonUtils.decode(json, Page.class); + page.setId(id);Alternatively, drop
{id}from the mapping if the body’s id is authoritative.base/src/main/java/com/tinyengine/it/controller/ComponentLibraryController.java (1)
101-113: Prefer PUT for update endpoint.Consider switching the update mapping to PUT for semantics and client expectations.
Apply:
- @PostMapping("/component-library/update/{id}") + @PutMapping("/component-library/update/{id}")Ensure
org.springframework.web.bind.annotation.PutMappingis imported.base/src/main/java/com/tinyengine/it/controller/AppExtensionController.java (1)
156-166: Use HTTP DELETE and a path variable for deletion.Delete operation is exposed as GET without a resource-anchored path.
Apply:
- @GetMapping("/apps/extension/delete") - public Result<AppExtension> deleteAppExtension(@RequestParam Integer id) { + @DeleteMapping("/apps/extension/{id}") + public Result<AppExtension> deleteAppExtension(@PathVariable Integer id) { return appExtensionService.deleteAppExtensionById(id); }And add the missing import:
+import org.springframework.web.bind.annotation.DeleteMapping;base/src/main/java/com/tinyengine/it/controller/AppController.java (6)
83-91: Path param docs OK; response schema likely incorrect.Same mismatch as above (Result vs App). Suggest aligning schema or confirm unwrapping.
- schema = @Schema(implementation = App.class))), + schema = @Schema(implementation = Result.class))),
104-112: Use @RequestBody (OpenAPI) for body docs instead of @parameter.@parameter is for path/query/header/cookie. Body should use io.swagger.v3.oas.annotations.parameters.RequestBody.
- @Operation(summary = "创建app", description = "创建app", - parameters = { - @Parameter(name = "app", description = "App入参对象") - }, responses = { + @Operation(summary = "创建app", description = "创建app", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "App入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = App.class)) + ), + responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = App.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败")} )
126-134: Body docs should use @RequestBody; parameter name casing.Rename "App" → "app" and switch to @RequestBody. Also adjust response schema to Result.
- @Operation(summary = "修改单个App信息", description = "修改单个App信息", - parameters = { - @Parameter(name = "id", description = "appId"), - @Parameter(name = "App", description = "入参对象")}, responses = { + @Operation(summary = "修改单个App信息", description = "修改单个App信息", + parameters = { + @Parameter(name = "id", description = "appId")}, + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = App.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", content = @Content(mediaType = "application/json", - schema = @Schema(implementation = App.class))), + schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败") })
148-156: Consider RESTful verb: use @DeleteMapping for deletions.Endpoint currently uses GET for delete; prefer @DeleteMapping("/apps/{id}") to reflect intent and ease client/tooling.
169-176: Response schema mismatch (Result vs App).Align with the actual envelope or confirm unwrapping.
- schema = @Schema(implementation = App.class))), + schema = @Schema(implementation = Result.class))),
190-198: Body docs for Map payload should use @RequestBody; consider a typed DTO.Replace @parameter on body with @RequestBody, and prefer a dedicated DTO over raw Map for validation/docs.
- @Operation(summary = "修改应用对应的国际化语种关联", description = "修改应用对应的国际化语种关联", - parameters = { - @Parameter(name = "id", description = "appId"), - @Parameter(name = "param", description = "入参对象")}, responses = { + @Operation(summary = "修改应用对应的国际化语种关联", description = "修改应用对应的国际化语种关联", + parameters = { + @Parameter(name = "id", description = "appId")}, + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Map.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = App.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败") })base/src/main/java/com/tinyengine/it/controller/MaterialController.java (5)
60-66: Response schema doesn’t reflect Result<List>.Use the envelope (or confirm a global unwrapping config).
- schema = @Schema(implementation = Material.class))), + schema = @Schema(implementation = Result.class))),
80-89: Document body with @RequestBody; fix parameter name casing.Switch from @parameter to @RequestBody; "Material" → "material".
- @Operation(summary = "创建Material", description = "创建Material", - parameters = { - @Parameter(name = "Material", description = "Material入参对象") - }, responses = { + @Operation(summary = "创建Material", description = "创建Material", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "Material入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Material.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = Material.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败") })
102-112: Body as @RequestBody; ‘id’ description typo (‘appId’).Fix description and schema envelope.
- @Operation(summary = "修改单个Material信息", description = "修改单个Material信息", - parameters = { - @Parameter(name = "id", description = "appId"), - @Parameter(name = "Material", description = "入参对象") - }, responses = { + @Operation(summary = "修改单个Material信息", description = "修改单个Material信息", + parameters = { + @Parameter(name = "id", description = "id") + }, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Material.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = Material.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败") })
125-134: Delete endpoint docs: response schema envelope.Align response schema with Result.
- schema = @Schema(implementation = Material.class))), + schema = @Schema(implementation = Result.class))),
146-154: Detail endpoint docs: response schema envelope.Align response schema with Result.
- schema = @Schema(implementation = Material.class))), + schema = @Schema(implementation = Result.class))),base/src/main/java/com/tinyengine/it/controller/I18nEntryController.java (9)
79-84: Add parameter docs for query params.Expose host and host_type in @operation to improve API docs.
- @Operation(summary = "通过app获取国际化词条列表", description = "通过app获取国际化词条列表", - responses = { + @Operation(summary = "通过app获取国际化词条列表", description = "通过app获取国际化词条列表", + parameters = { + @Parameter(name = "host", description = "host"), + @Parameter(name = "host_type", description = "host类型") + }, responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", schema = @Schema())), + content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败") })
99-107: Response schema type mismatch (returns I18nEntryDto).Update schema (or wrap with Result if not unwrapped globally).
- schema = @Schema(implementation = I18nEntry.class))), + schema = @Schema(implementation = Result.class))),
121-129: Use @RequestBody for body; response is a list.Switch body docs and align envelope.
- @Operation(summary = "创建国际化多语言词条", description = "创建国际化多语言词条", - parameters = { - @Parameter(name = "OperateI18nEntries", description = "入参对象") - }, responses = { + @Operation(summary = "创建国际化多语言词条", description = "创建国际化多语言词条", + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = OperateI18nEntries.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = I18nEntry.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))), @ApiResponse(responseCode = "400", description = "请求失败") })
144-152: Batch create: same body doc and response considerations.Mirror the RequestBody approach; return envelope.
- parameters = { - @Parameter(name = "operateI18nBatchEntries", description = "入参对象") - }, responses = { + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = OperateI18nBatchEntries.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = I18nEntry.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
169-178: Update single: response is I18nEntryDto; document body via @RequestBody.Adjust both body and response schema.
- parameters = { - @Parameter(name = "id", description = "I18nEntries主键id"), - @Parameter(name = "i18nEntries", description = "入参对象") - }, responses = { + parameters = { + @Parameter(name = "id", description = "I18nEntries主键id") + }, requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = I18nEntry.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = I18nEntry.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
195-203: Update multiple: use @RequestBody; response is a list.Align docs with payload and envelope.
- parameters = { - @Parameter(name = "operateI18nEntries", description = "入参对象") - }, responses = { + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = OperateI18nEntries.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = I18nEntry.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
220-228: Param name typo and response type mismatch.Rename iDeleteI18nEntry → deleteI18nEntry to match method; response is List.
- parameters = { - @Parameter(name = "iDeleteI18nEntry", description = "入参对象") - }, responses = { + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = DeleteI18nEntry.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = I18nEntry.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
246-254: Multipart upload: document as multipart/form-data and correct response.Use @RequestBody with mediaType multipart/form-data; response should be Result.
- parameters = { - @Parameter(name = "id", description = "appId"), - @Parameter(name = "filesMap", description = "文件参数对象") - }, responses = { + parameters = { @Parameter(name = "id", description = "appId") }, + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "文件参数对象", required = true, + content = @Content(mediaType = "multipart/form-data", + schema = @Schema(implementation = Map.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", schema = @Schema())), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
290-298: Batch upload: same multipart and response envelope considerations.Mirror single-file endpoint docs here as well.
- parameters = { - @Parameter(name = "id", description = "appId"), - @Parameter(name = "filesMap", description = "文件参数对象") - }, responses = { + parameters = { @Parameter(name = "id", description = "appId") }, + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "文件参数对象", required = true, + content = @Content(mediaType = "multipart/form-data", + schema = @Schema(implementation = Map.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", schema = @Schema())), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),base/src/main/java/com/tinyengine/it/controller/BlockGroupController.java (4)
70-79: Parameter names in docs don’t match actual query params.Docs use ids/appId/from, but method expects id/app/from. Align names to avoid broken clients/generated SDKs.
- parameters = { - @Parameter(name = "ids", description = "分组ids"), - @Parameter(name = "appId", description = "appId"), - @Parameter(name = "from", description = "区分是在物料管理还是区块管理(block:在区块管理)") - }, responses = { + parameters = { + @Parameter(name = "id", description = "分组ids"), + @Parameter(name = "app", description = "appId"), + @Parameter(name = "from", description = "区分是在物料管理还是区块管理(block:在区块管理)") + }, responses = {Also consider documenting the Result envelope in the 200 response.
- content = @Content(mediaType = "application/json", schema = @Schema())), + content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))),
97-105: Create: use @RequestBody for body; rename blockGroups → blockGroup; response envelope.- parameters = { - @Parameter(name = "blockGroups", description = "入参对象") - }, responses = { + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = BlockGroup.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", - schema = @Schema(implementation = BlockGroup.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
119-127: Update: use @RequestBody; response returns a list.Align body docs and response envelope/list.
- parameters = { - @Parameter(name = "id", description = "分组id"), - @Parameter(name = "blockGroups", description = "入参对象") - }, responses = { + parameters = { @Parameter(name = "id", description = "分组id") }, + requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( + description = "入参对象", required = true, + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = BlockGroup.class)) + ), responses = { @ApiResponse(responseCode = "200", description = "返回信息", - content = @Content(mediaType = "application/json", schema = @Schema(implementation = BlockGroup.class))), + content = @Content(mediaType = "application/json", schema = @Schema(implementation = Result.class))),
146-154: Delete-by-id: use @DeleteMapping; response type docs.Prefer @DeleteMapping and align schema with Result<List>.
- content = @Content(mediaType = "application/json", - schema = @Schema(implementation = BlockGroup.class))), + content = @Content(mediaType = "application/json", + schema = @Schema(implementation = Result.class))),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (12)
base/src/main/java/com/tinyengine/it/controller/AppController.java(7 hunks)base/src/main/java/com/tinyengine/it/controller/AppExtensionController.java(5 hunks)base/src/main/java/com/tinyengine/it/controller/BlockGroupController.java(4 hunks)base/src/main/java/com/tinyengine/it/controller/CanvasController.java(1 hunks)base/src/main/java/com/tinyengine/it/controller/ComponentController.java(3 hunks)base/src/main/java/com/tinyengine/it/controller/ComponentLibraryController.java(5 hunks)base/src/main/java/com/tinyengine/it/controller/DataSourceController.java(5 hunks)base/src/main/java/com/tinyengine/it/controller/I18nEntryController.java(9 hunks)base/src/main/java/com/tinyengine/it/controller/MaterialController.java(5 hunks)base/src/main/java/com/tinyengine/it/controller/ModelController.java(7 hunks)base/src/main/java/com/tinyengine/it/controller/PageController.java(6 hunks)base/src/main/java/com/tinyengine/it/controller/ResourceController.java(1 hunks)
🔇 Additional comments (9)
base/src/main/java/com/tinyengine/it/controller/ResourceController.java (1)
337-338: Formatting-only change is correct.Re-indentation of the ternary for Content-Disposition is fine; no behavior change.
base/src/main/java/com/tinyengine/it/controller/DataSourceController.java (1)
64-72: OpenAPI annotation reformat looks good.Parameters and responses preserved; only indentation/line-break changes.
Also applies to: 87-95, 109-117, 131-140, 154-162
base/src/main/java/com/tinyengine/it/controller/PageController.java (1)
79-87: Annotation formatting changes are fine.No behavior change; docs structure consistent.
Also applies to: 102-110, 125-133, 154-162, 197-205, 218-225
base/src/main/java/com/tinyengine/it/controller/ModelController.java (1)
62-73: Annotation reformat reads well.No API or logic changes; OK to merge.
Also applies to: 89-97, 111-119, 134-143, 158-166, 180-188, 201-209
base/src/main/java/com/tinyengine/it/controller/ComponentLibraryController.java (1)
60-66: Annotation formatting changes look good.Also applies to: 80-87, 101-110, 125-133, 146-154
base/src/main/java/com/tinyengine/it/controller/CanvasController.java (1)
58-67: Annotation reformat LGTM.No behavior change.
base/src/main/java/com/tinyengine/it/controller/AppExtensionController.java (1)
91-99: Annotation formatting changes are fine.Also applies to: 116-123, 136-143
base/src/main/java/com/tinyengine/it/controller/ComponentController.java (1)
64-71: OpenAPI annotation reformat otherwise looks good.Also applies to: 95-102, 125-132
base/src/main/java/com/tinyengine/it/controller/AppController.java (1)
63-69: Align @operation response schema with actual return type (Result<List>)Project uses springdoc-openapi (pom) and has OpenApiConfig, but no ModelConverter/OpenApiCustomiser/OperationCustomizer was found to unwrap a Result envelope — the @operation currently documents App while the controller returns Result<List>. Either enable global unwrapping or change the response schema to the Result envelope (e.g. schema = @Schema(implementation = Result.class) or create a ResultOfApp DTO representing Result<List>).
File: base/src/main/java/com/tinyengine/it/controller/AppController.java Lines: 63-69
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Documentation
Style