Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the result validation structure to unify common validation logic for DocumentResult into the abstract layer and updates package structures accordingly.
- Introduces new validation methods (expect and expectValue) in the Reactive and Mvc document result implementations.
- Renames JsonResultMatcher to ExpectedJsonValue and updates related aggregation logic.
- Moves controllers and test classes to a dedicated "controller" package to better organize the code.
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| documentify-sample/reactive-sample/src/main/kotlin/io/github/bgmsound/documentify/sample/reactive/controller/SampleController.kt | Updated package declaration and refined REST controller method. |
| Several test files under documentify-sample/mvc-sample/src/test/kotlin/io/github/bgmsound/documentify/sample/mvc/documentation/ | Updated import paths to reflect new controller package structure. |
| documentify-project/documentify-reactive and documentify-project/documentify-mvc emitter classes | Refactored validation methods from validateJsonPath to expect and expectValue. |
| documentify-project/documentify-core/emitter and specification classes | Renamed JsonResultMatcher to ExpectedJsonValue and updated API calls accordingly. |
Comments suppressed due to low confidence (1)
documentify-project/documentify-core/src/main/kotlin/io/github/bgmsound/documentify/core/specification/schema/ResourceSpec.kt:32
- [nitpick] If the companion accessor allows it, consider using 'Link.newLink(rel)' directly for improved readability.
val link = Link.Companion.newLink(rel)
| val value = matcher.expectedValue | ||
| if (jsonPath.endsWith("[*]")) { | ||
| if (value !is List<*>) { | ||
| throw IllegalArgumentException("sample value type must be List") |
There was a problem hiding this comment.
Consider enhancing the error message to include the actual type of the received value for easier debugging of type mismatches.
Suggested change
| throw IllegalArgumentException("sample value type must be List") | |
| throw IllegalArgumentException("sample value type must be List, but was ${value::class.simpleName}") |
Test Results17 tests 17 ✅ 13s ⏱️ Results for commit 2302476. |
Code Coverage Report
Files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unify the common validation logic for DocumentResult into the abstract layer from its subclasses.