Skip to content
Open
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
3 changes: 0 additions & 3 deletions sdks/community/kotlin/library/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ kotlin {
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.datetime)

// Json Patching
implementation(libs.kotlin.json.patch)

// HTTP client dependencies - core only (no engine)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.content.negotiation)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2016 flipkart.com zjsonpatch.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.agui.client.jsonpatch
import kotlinx.serialization.json.*

class ApplyProcessor(private val target: JsonElement) : JsonPatchApplyProcessor(target.deepCopy()) {
fun result(): JsonElement = targetSource
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2016 flipkart.com zjsonpatch.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.agui.client.jsonpatch

/**
* Created by tomerga on 04/09/2016.
*/
enum class CompatibilityFlags {
MISSING_VALUES_AS_NULLS;


companion object {
fun defaults(): Set<CompatibilityFlags> {
return setOf(CompatibilityFlags.MISSING_VALUES_AS_NULLS)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.agui.client.jsonpatch

open class Constants {
open val OP = "op"
open val VALUE = "value"
open val PATH = "path"
open val FROM = "from"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright 2016 flipkart.com zjsonpatch.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.agui.client.jsonpatch

import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonNull
import kotlin.jvm.JvmStatic

internal class Diff {
val operation: Int
val path: MutableList<Any>
val value: JsonElement
val toPath: List<Any> //only to be used in move operation

constructor(operation: Int, path: List<Any>, value: JsonElement) {
this.operation = operation
this.path = path.toMutableList()
this.toPath= listOf()
this.value = value
}

constructor(operation: Int, fromPath: List<Any>, toPath: List<Any>) {
this.operation = operation
this.path = fromPath.toMutableList()
this.toPath = toPath
this.value = JsonNull
}

companion object {

@JvmStatic
fun generateDiff(replace: Int, path: List<Any>, target: JsonElement): Diff {
return Diff(replace, path, target)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2016 flipkart.com zjsonpatch.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.agui.client.jsonpatch

/**
* User: holograph
* Date: 03/08/16
*/
class InvalidJsonPatchException : JsonPatchApplicationException {
constructor(message: String) : super(message) {}

constructor(message: String, cause: Throwable) : super(message, cause) {}

constructor(cause: Throwable) : super(cause) {}
}
Loading
Loading