Skip to content

Update project #71

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
merged 8 commits into from
Feb 19, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
java-version: 11

- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: build --scan --full-stacktrace

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/githubpages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: ./gradlew -Pversion=${{ github.event.release.tag_name }} dokkaHtml

- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
java-version: 11

- name: assemble
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: assemble -Pversion=${{ inputs.version }}

Expand All @@ -44,6 +44,6 @@ jobs:
path: '**/build/reports/**'

- name: Publish final version
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: -Pversion=${{ inputs.version }} publishAllPublicationsToMavenCentralRepository
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ jobs:
fetch-depth: 0

- name: Set up Java
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11

- name: Build
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3
with:
arguments: build
17 changes: 11 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
application
alias(libs.plugins.kotlin)
alias(libs.plugins.spotless)
alias(libs.plugins.kotest.multiplatform)
Expand All @@ -33,7 +32,12 @@ repositories {

spotless {
kotlin {
ktfmt().googleStyle()
ktfmt().kotlinlangStyle().configure {
it.setBlockIndent(2)
it.setContinuationIndent(2)
it.setRemoveUnusedImports(true)
it.setManageTrailingCommas(true)
}
}
}

Expand All @@ -54,9 +58,6 @@ tasks {
exceptionFormat = TestExceptionFormat.FULL
events = setOf(SKIPPED, FAILED, STANDARD_OUT, STANDARD_ERROR)
}
}

test {
useJUnitPlatform()
}
}
Expand All @@ -71,7 +72,11 @@ kotlin {
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs()
wasmJs {
browser()
nodejs()
d8()
}
linuxX64()
macosX64()
macosArm64()
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
kotlin.code.style=official

GROUP=io.github.nomisrev
SONATYPE_HOST=S01
RELEASE_SIGNING_ENABLED=true

POM_NAME=kotlinx-serialization-jsonpath
POM_ARTIFACT_ID=kotlinx-serialization-jsonpath
POM_NAME=Kotlinx Serialization JsonPath
POM_DESCRIPTION=JsonPath offers a simple DSL to work with JsonElement from Kotlinx Serialization Json, this allows you to easily work with JSON in Kotlin in a typed manner.
POM_URL=https://github.com/nomisrev/kotlinx-serialization-jsonpath/

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 10 additions & 10 deletions libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[versions]
arrow = "2.0.0-alpha.1"
dokka = "1.9.20"
kotlin = "2.0.0-RC3"
kotest = "5.9.0"
kover = "0.8.0"
detekt = "1.23.5"
kotest-arrow="1.4.0"
kotlinx-json="1.6.3"
arrow = "2.0.1"
dokka = "2.0.0"
kotlin = "2.1.10"
kotest = "6.0.0.M2"
kover = "0.9.1"
detekt = "1.23.7"
kotest-arrow="2.0.0"
kotlinx-json="1.8.0"
kotlinx-knit="0.5.0"
publish="0.28.0"
publish="0.30.0"
knit="0.5.0"
spotless="6.25.0"
spotless="7.0.2"

[libraries]
arrow-optics = { module = "io.arrow-kt:arrow-optics", version.ref = "arrow" }
Expand Down
11 changes: 0 additions & 11 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ pluginManagement {
}
}

plugins {
id("com.gradle.enterprise") version "3.16.2"
}

dependencyResolutionManagement {
versionCatalogs {
create("libs") {
Expand All @@ -23,10 +19,3 @@ dependencyResolutionManagement {
gradlePluginPortal()
}
}

gradleEnterprise {
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
}
}
21 changes: 9 additions & 12 deletions src/commonTest/kotlin/io/github/nomisrev/JsonDSLSpec.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.github.nomisrev

import io.kotest.common.Platform
import io.kotest.common.platform
import io.kotest.core.spec.style.StringSpec
import io.kotest.matchers.nulls.shouldBeNull
import io.kotest.matchers.shouldBe
Expand Down Expand Up @@ -99,63 +97,62 @@ class JsonDSLSpec : StringSpec({
JsonPath.select("streets").getOrNull(cityJson) shouldBe (cityJson as? JsonObject)?.get("streets")
}
}

// See https://github.com/Kotlin/kotlinx.serialization/issues/1914
"extract from object".config(enabled = platform != Platform.Native) {

"extract from object" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath.extract(City.serializer())
.getOrNull(cityJson) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson)
}
}

"get from array, using select and get".config(enabled = platform != Platform.Native) {
"get from array, using select and get" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath.select("streets")[0]
.extract(Street.serializer())
.getOrNull(cityJson) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson).streets.getOrNull(0)
}
}

"get from array, using get".config(enabled = platform != Platform.Native) {
"get from array, using get" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath["streets"][0]["name"].string
.getOrNull(cityJson) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson).streets.getOrNull(0)?.name
}
}

"get from array, using get".config(enabled = platform != Platform.Native) {
"get from array, using get range" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath["streets"][0..0]["name"].string
.getAll(cityJson)
.getOrNull(0) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson).streets.getOrNull(0)?.name
}
}

"get from array, using select with special syntax".config(enabled = platform != Platform.Native) {
"get from array, using select with special syntax" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath.select("['streets']").select("[0]")
.extract(Street.serializer())
.getOrNull(cityJson) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson).streets.getOrNull(0)
}
}

"get from array, using path".config(enabled = platform != Platform.Native) {
"get from array, using path" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath.path("streets[0]")
.extract(Street.serializer())
.getOrNull(cityJson) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson).streets.getOrNull(0)
}
}

"get all elements from array".config(enabled = platform != Platform.Native) {
"get all elements from array" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath.select("streets").selectEvery("*").select("name")
.string
.getAll(cityJson) shouldBe Json.decodeFromJsonElement(City.serializer(), cityJson).streets.map { it.name }
}
}

"get all elements from array, using path".config(enabled = platform != Platform.Native) {
"get all elements from array, using path" {
checkAll(Arb.json(Arb.city())) { cityJson ->
JsonPath.pathEvery("streets.*.name")
.string
Expand Down
2 changes: 0 additions & 2 deletions src/commonTest/kotlin/io/github/nomisrev/KotestConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,4 @@ object KotestConfig : AbstractProjectConfig() {
override val testCaseOrder: TestCaseOrder =
TestCaseOrder.Random



}
Loading