kinbiko / kinbiko/jsonassert

Feature Request: support for partial JSON matching

Open
#20 6 comments 7 reactions 0 assignees Claimed by @kinbiko View on GitHub
enhancement
Dominant language
Go
Stars
143
Forks
18
Avg merge
2d 15h
Merged PRs (30d)
3

Description

Hello. First of all, great package!
It really reduces boilerplate code in tests and makes everything more readable.

I have a feature request/consideration I hope would get included to this project and I may help implement it if that's something that makes sense for this library: **Partial JSON matching**.

It can be behind a flag or in another method, but it basically means a JSON with 4 properties, when checked against a JSON with 2 properties, would not return the following error:

> expected 2 keys at '$' but got 4 keys
> unexpected object key(s) ["status","cause"] found at '$'

More often than not, we need to check for the overall structure and main fields and not the whole thing, and having to check for presence of every single field can take a lot of time.

Is this something that makes sense for you as the author of this library?
As much as I like creating my own fork, I think it's best for the community if we keep things centralized.

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing linked pull request #42, since the issue names no files, tests, or entry points. Clarify the matching API and flag behavior there, then add coverage showing that extra JSON properties are accepted while the requested structure and fields still match.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.