Skip to content
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

Release 0.7.0-alpha1 #42

Merged
merged 2 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ JsonStringAssert.assertThat(response.content).jsonMatches("""
""".trimIndent())
```

It is recommended to use json-fuzzy-match with languages which have multi-line string literal such as Kotlin, Scala, Java 13+ and Groovy.
It is recommended to use json-fuzzy-match with languages which have multi-line string literal such as Kotlin, Scala,
Java 13+ and Groovy.
Sample codes in this README are written in Kotlin.

## Install

json-fuzzy-match is available on [Maven Central](https://central.sonatype.com/artifact/io.github.orangain/json-fuzzy-match).
json-fuzzy-match is available
on [Maven Central](https://central.sonatype.com/artifact/io.github.orangain/json-fuzzy-match).

### Gradle Kotlin DSL

```kts
dependencies {
testImplementation("io.github.orangain:json-fuzzy-match:0.6.0")
testImplementation("io.github.orangain:json-fuzzy-match:0.7.0-alpha1")
}
```

Expand All @@ -66,14 +68,15 @@ dependencies {
<dependency>
<groupId>io.github.orangain</groupId>
<artifactId>json-fuzzy-match</artifactId>
<version>0.6.0</version>
<version>0.7.0-alpha1</version>
</dependency>
</dependencies>
```

## Usage

json-fuzzy-match provides both [AssertJ](https://joel-costigliola.github.io/assertj/)-style and [JUnit](https://junit.org/junit5/)-style assertions.
json-fuzzy-match provides both [AssertJ](https://joel-costigliola.github.io/assertj/)-style
and [JUnit](https://junit.org/junit5/)-style assertions.

```kt
// AssertJ-style
Expand Down Expand Up @@ -113,7 +116,8 @@ There are several markers as followings:

### Optional marker

You can use double hash `##` to mark a field as optional. For example, `##string` means that the field can be a string, null or not present.
You can use double hash `##` to mark a field as optional. For example, `##string` means that the field can be a string,
null or not present.

### Examples

Expand Down Expand Up @@ -142,11 +146,12 @@ You can use double hash `##` to mark a field as optional. For example, `##string
* `{ "id": "123" }` does not match the pattern `{ "id": "#regex [a-z]+" }`

#### Advanced array marker

* `{ "tags": ["awesome", "shop"] }` matches the following patterns:
* `{ "tags": "#[]" }`
* `{ "tags": "#[2]" }`
* `{ "tags": "#[] #string" }`
* `{ "tags": "#[2] #string" }`
* `{ "tags": "#[]" }`
* `{ "tags": "#[2]" }`
* `{ "tags": "#[] #string" }`
* `{ "tags": "#[2] #string" }`

## License

Expand All @@ -156,5 +161,6 @@ MIT License. See `LICENSE`.

I'm very grateful for the [Karate](https://intuit.github.io/karate/) and its authors.
The idea of the marker is heavily inspired by the Karate's wonderful fuzzy matching feature.
Though json-fuzzy-match does not depend on Karate now, the first version of this library only provided a thin wrapper of Karate's feature.
Though json-fuzzy-match does not depend on Karate now, the first version of this library only provided a thin wrapper of
Karate's feature.
Without it, I was not able to develop this library so quickly.
5 changes: 3 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

group = "io.github.orangain"
version = "0.6.0"
version = "0.7.0-alpha1"

repositories {
mavenCentral()
Expand Down Expand Up @@ -89,5 +89,6 @@ tasks.named<SonatypeCentralUploadTask>("sonatypeCentralUpload") {
)

signingKey = System.getenv("PGP_SIGNING_KEY") // This is your PGP private key. This is required to sign your files
signingKeyPassphrase = System.getenv("PGP_SIGNING_KEY_PASSPHRASE") // This is your PGP private key passphrase (optional) to decrypt your private key
signingKeyPassphrase =
System.getenv("PGP_SIGNING_KEY_PASSPHRASE") // This is your PGP private key passphrase (optional) to decrypt your private key
}