fix(naming): 添加分页参数验证#14616
Conversation
- 在实例列表查询接口中增加 pageForm.validate() 验证调用 - 确保分页参数在处理前进行有效性检查
|
Thanks for your this PR. 🙏 感谢您提交的PR。 🙏 |
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
* Add core coverage (#14608) * test(core-utils): remove unused method and add comprehensive unit tests. * test(web): add unit tests for NacosCoreWebConfiguration and NacosWebServerListener。 * test(core): add unit tests for parts of remote package. * add core unit test coverage (#14618) * test(core): add unit tests for plugin forms and prompt request extractor. * test(core): add unit tests for remote param check and connection ejector. * fix(naming): 添加分页参数验证 (#14616) - 在实例列表查询接口中增加 pageForm.validate() 验证调用 - 确保分页参数在处理前进行有效性检查 * test(auth): add and improve unit tests for auth module. (#14619) * [ISSUE #14622] fix: exclude json-schema-validator 3.0.0 from agentscope-core to resolve NoClassDefFoundError (#14625) agentscope-core:1.0.7 directly depends on json-schema-validator:3.0.0 (Jackson 3), which overrides the 1.5.7 version required by mcp-json-jackson2:0.14.1 (Jackson 2). This causes NoClassDefFoundError for SpecVersion$VersionFlag when using the 'Auto import from MCP Server' feature, since SpecVersion.VersionFlag was renamed to SpecificationVersion in json-schema-validator 2.0.0+. Excluding json-schema-validator from agentscope-core allows mcp's transitive dependency (1.5.7) to take effect, resolving the conflict. * test(consistency): add unit tests for serializers, processors and utils. (#14628) * fix(health): update health status method to handle persistent instances correctly (#14635) * Refactor database plugins and update CI report paths (#14640) * refactor(plugin): Refactor default database plugin, split database plugins and move depend jdbc to plugins dir. * fix(ci): update JaCoCo report paths for datasource plugins in CI workflow * fix(pom): update maven-antrun-plugin version and correct task tags * chore(db): remove derby and mysql schemas, add AI resource mappers. --------- Co-authored-by: Lichenkang <2188718831@qq.com> Co-authored-by: Sunrisea <1336317033@qq.com>
* Add core coverage (#14608) * test(core-utils): remove unused method and add comprehensive unit tests. * test(web): add unit tests for NacosCoreWebConfiguration and NacosWebServerListener。 * test(core): add unit tests for parts of remote package. * add core unit test coverage (#14618) * test(core): add unit tests for plugin forms and prompt request extractor. * test(core): add unit tests for remote param check and connection ejector. * fix(naming): 添加分页参数验证 (#14616) - 在实例列表查询接口中增加 pageForm.validate() 验证调用 - 确保分页参数在处理前进行有效性检查 * test(auth): add and improve unit tests for auth module. (#14619) * [ISSUE #14622] fix: exclude json-schema-validator 3.0.0 from agentscope-core to resolve NoClassDefFoundError (#14625) agentscope-core:1.0.7 directly depends on json-schema-validator:3.0.0 (Jackson 3), which overrides the 1.5.7 version required by mcp-json-jackson2:0.14.1 (Jackson 2). This causes NoClassDefFoundError for SpecVersion$VersionFlag when using the 'Auto import from MCP Server' feature, since SpecVersion.VersionFlag was renamed to SpecificationVersion in json-schema-validator 2.0.0+. Excluding json-schema-validator from agentscope-core allows mcp's transitive dependency (1.5.7) to take effect, resolving the conflict. * test(consistency): add unit tests for serializers, processors and utils. (#14628) * fix(health): update health status method to handle persistent instances correctly (#14635) * Refactor database plugins and update CI report paths (#14640) * refactor(plugin): Refactor default database plugin, split database plugins and move depend jdbc to plugins dir. * fix(ci): update JaCoCo report paths for datasource plugins in CI workflow * fix(pom): update maven-antrun-plugin version and correct task tags * chore(db): remove derby and mysql schemas, add AI resource mappers. --------- Co-authored-by: Lichenkang <2188718831@qq.com> Co-authored-by: Sunrisea <1336317033@qq.com>
What is the purpose of the change
在实例列表查询接口中补充分页参数校验,避免非法的
pageNo或pageSize参数直接进入后续处理流程。当前
ConsoleInstanceController#getInstanceList中已经调用了instanceForm.validate()对实例查询相关参数进行校验,但没有调用pageForm.validate()对分页参数进行校验。项目中的其他分页查询接口通常都会在处理前执行该校验,因此这里存在一致性缺失的问题。本次修改通过在实例列表查询接口中增加
pageForm.validate()调用,使该接口能够在入口处提前拦截非法分页参数,保持与其他 controller 的处理方式一致,并提升接口参数校验的完整性。Brief changelog
pageForm.validate()验证调用Verifying this change
ConsoleInstanceController#getInstanceList在调用instanceProxy.listInstances(...)前新增了pageForm.validate()PageForm现有实现,无新增行为分支,仅补齐遗漏的入口校验pageNo=0、pageSize=0)验证接口会提前返回参数错误,而不是继续进入后续处理流程