feat: change JSONChildren method to return all children, not just JSONPathers #107
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.
See #106.
I'm sure if this is actually the right solution, but works for my use-case so I'm using my fork for now and we can discuss the approach here. Happy to refactor as needed.
traversal_test.go didn't feel correct so I've updated them as I expect them to work. The main issue was around how to check if a keyword has a nested prop using Schema.HasProp(), I don't think this works as expected because you can't apply type conversion from say
Not
to*Schema
(see lines 89-94). As such I've added a new interface which can be implemented by Keywords which contain a schema, and exports a GetSchema() function.There is an alternative approach which could also make this work, you could add
HasKeyword()
to theJSONPather
interface. The naming would seem kind of wrong though, so you could renameHasKeyword()
toHasProp()
to be consistent with theJSONPather
terminology, however this would be a breaking change.