Skip to content

IDEA: assertk-json extension library #280

Description

@seepick

hi, very often i am in need of testing some JSON response, whereas i don't care about whitespace and ordering of keys within the JSON (semantic comparison).
there is the JSONAssert library, which can do that. and sometimes i need to "dig into" the JSON, which can be done with json-path.

e.g. transforming JSONAssert.assertEquals(expectedJson, actualJson, jsontMode) into fun Assert<String>.isJsonEquals(expectedJson: String, mode: JsonMode = JsonMode.Strict)

my idea would be to create another artifact, depending on the "assertk-core" library, and simply adding a transitive dependency with such a thin layer making the libs reusable via the fluent assertk assertions.

WDTY?

Activity

  1. evant commented on Feb 3, 2020

    @evant
    Collaborator

    Seems like a good idea. We've been planning an android extension lib in a similar vein for a while, but haven't had the time for it. If you want to work on it, I'd be glad to help review the design.

  2. evant commented on Feb 3, 2020

    @evant
    Collaborator

    One thing to note: right now assertk is multiplatform and it would be cool for a json artifact to be as well. But the libs you linked to are java only. Re-implementing in kotlin would be a fair bit of work though if those don't already exist so understand if you wouldn't want to go down that route.

  3. seepick commented on Feb 3, 2020

    @seepick
    ContributorAuthor

    i wasn't aware of the fact that assertk is multiplatform, until my first PR ;) very sophisticated, nice job.

    and yes, you are right, it seems a bit much to re-implement a proper json assertion functionality from scratch... have to check the licenses and maybe just copy'n'paste the relevant stuff might be enough?!

    how about "to help review the design"? where can i be of support exactly?

  4. evant commented on Feb 3, 2020

    @evant
    Collaborator

    I meant I can help review prs/help with any discussions on what the api should look like, if you were interested in implementing this feature.

  5. locked and limited conversation to collaborators on Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions