-
Notifications
You must be signed in to change notification settings - Fork 57
Further path improvements #1868
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
Merged
joelrosario
merged 7 commits into
main
from
copilot/fix-a92f6387-2747-4260-bfb9-9bc4fcb19006
May 30, 2025
Merged
Further path improvements #1868
joelrosario
merged 7 commits into
main
from
copilot/fix-a92f6387-2747-4260-bfb9-9bc4fcb19006
May 30, 2025
+303
−28
Conversation
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
…rredPattern Co-authored-by: joelrosario <63343+joelrosario@users.noreply.github.com>
Co-authored-by: joelrosario <63343+joelrosario@users.noreply.github.com>
Co-authored-by: joelrosario <63343+joelrosario@users.noreply.github.com>
Copilot finished work on behalf of
joelrosario
May 29, 2025 20:10
joelrosario
requested changes
May 30, 2025
Co-authored-by: joelrosario <63343+joelrosario@users.noreply.github.com>
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot finished work on behalf of
joelrosario
May 30, 2025 04:55
joelrosario
reviewed
May 30, 2025
core/src/main/kotlin/io/specmatic/core/pattern/JSONObjectPattern.kt
Outdated
Show resolved
Hide resolved
…eadability Co-authored-by: joelrosario <63343+joelrosario@users.noreply.github.com>
Copilot finished work on behalf of
joelrosario
May 30, 2025 05:24
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.
Problem
The current implementation of
calculatePath
inJSONObjectPattern.kt
had limitations when handling deeply nested AnyPattern structures:DeferredPattern("(Address)")
, the typeAlias extraction didn't properly handle the parentheses cleanupSolution
Key Changes
1. Enhanced AnyPattern.calculatePath()
DeferredPattern.pattern
and clean parentheses properlycalculatePath()
to discover nested AnyPatterns2. Simplified JSONObjectPattern.calculatePathForAnyPattern()
AnyPattern.calculatePath()
Examples
Before: DeferredPattern typeAlias extraction was inconsistent
// DeferredPattern("(Address)") might not properly extract "Address"
After: Proper typeAlias extraction and nested path discovery
Test Coverage
Added comprehensive test cases covering all scenarios mentioned in the requirements:
Backward Compatibility
All changes are backward compatible and maintain existing functionality while extending capabilities for deeply nested structures. Existing test cases continue to pass with the same expected behavior.
Files Changed
core/src/main/kotlin/io/specmatic/core/pattern/AnyPattern.kt
- Enhanced calculatePath methodcore/src/main/kotlin/io/specmatic/core/pattern/JSONObjectPattern.kt
- Simplified path handlingcore/src/test/kotlin/io/specmatic/core/CalculatePathTest.kt
- Added comprehensive test coverage💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.