Skip to content

Commit

Permalink
style: apply linters automatic fixes (#1378)
Browse files Browse the repository at this point in the history
Signed-off-by: Hyperledger Bot <[email protected]>
Co-authored-by: Hyperledger Bot <[email protected]>
  • Loading branch information
github-actions[bot] and hyperledger-bot authored Sep 26, 2024
1 parent 768b1fb commit 4bb3d01
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,14 @@
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
"UnusedImport",
)

package org.hyperledger.identus.client.models

import com.google.gson.*
import com.google.gson.annotations.JsonAdapter
import com.google.gson.annotations.SerializedName


/**
* A service expressed in the DID document. https://www.w3.org/TR/did-core/#services
*
* @param id The id of the service. Requires a URI fragment when use in create / update DID. Returns the full ID (with DID prefix) when resolving DID
* @param type
* @param serviceEndpoint
*/

import com.google.gson.*
import java.lang.reflect.Type

class StringOrStringArrayAdapter : JsonSerializer<List<String>>, JsonDeserializer<List<String>> {
Expand All @@ -50,15 +39,13 @@ class StringOrStringArrayAdapter : JsonSerializer<List<String>>, JsonDeserialize
override fun serialize(src: List<String>?, typeOfSrc: Type?, context: JsonSerializationContext?): JsonElement {
return when {
src == null -> JsonNull.INSTANCE
src.size == 1 -> JsonPrimitive(src[0]) // If only one string, serialize as a single string
else -> context!!.serialize(src) // Otherwise, serialize as a list
src.size == 1 -> JsonPrimitive(src[0]) // If only one string, serialize as a single string
else -> context!!.serialize(src) // Otherwise, serialize as a list
}
}
}



data class Service (
data class Service(

/* The id of the service. Requires a URI fragment when use in create / update DID. Returns the full ID (with DID prefix) when resolving DID */
@SerializedName("id")
Expand All @@ -69,7 +56,6 @@ data class Service (
val type: kotlin.collections.List<kotlin.String>? = null,

@SerializedName("serviceEndpoint")
val serviceEndpoint: JsonElement? = null
val serviceEndpoint: JsonElement? = null,

)

Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,23 @@
"ArrayInDataClass",
"EnumEntryName",
"RemoveRedundantQualifierName",
"UnusedImport"
"UnusedImport",
)

package org.hyperledger.identus.client.models

import com.google.gson.annotations.SerializedName
import com.google.gson.JsonElement
import com.google.gson.annotations.SerializedName

/**
* A patch to existing Service. 'type' and 'serviceEndpoint' cannot both be empty.
*
* @param id The id of the service to update
* @param type
* @param serviceEndpoint
* @param type
* @param serviceEndpoint
*/


data class UpdateManagedDIDServiceAction (
data class UpdateManagedDIDServiceAction(

/* The id of the service to update */
@SerializedName("id")
Expand All @@ -37,7 +36,6 @@ data class UpdateManagedDIDServiceAction (
val type: kotlin.collections.List<kotlin.String>? = null,

@SerializedName("serviceEndpoint")
val serviceEndpoint: JsonElement? = null
val serviceEndpoint: JsonElement? = null,

)

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ open class ListenToEvents(
private val gson = GsonBuilder()
.registerTypeAdapter(
OffsetDateTime::class.java,
CustomGsonObjectMapperFactory.OffsetDateTimeTypeAdapter()
CustomGsonObjectMapperFactory.OffsetDateTimeTypeAdapter(),
)
.create()

Expand All @@ -47,29 +47,29 @@ open class ListenToEvents(
TestConstants.EVENT_TYPE_CONNECTION_UPDATED -> connectionEvents.add(
gson.fromJson(
eventString,
ConnectionEvent::class.java
)
ConnectionEvent::class.java,
),
)

TestConstants.EVENT_TYPE_ISSUE_CREDENTIAL_RECORD_UPDATED -> credentialEvents.add(
gson.fromJson(
eventString,
CredentialEvent::class.java
)
CredentialEvent::class.java,
),
)

TestConstants.EVENT_TYPE_PRESENTATION_UPDATED -> presentationEvents.add(
gson.fromJson(
eventString,
PresentationEvent::class.java
)
PresentationEvent::class.java,
),
)

TestConstants.EVENT_TYPE_DID_STATUS_UPDATED -> didEvents.add(
gson.fromJson(
eventString,
DidEvent::class.java
)
DidEvent::class.java,
),
)

else -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ class UpdateDidSteps {
serviceEndpoint.asString.contains(serviceUrl)
} else if (serviceEndpoint.isJsonArray) {
serviceEndpoint.asJsonArray.any { it.asString.contains(serviceUrl) }
} else false
} else {
false
}
}
},
equalTo(true),
Expand Down

0 comments on commit 4bb3d01

Please sign in to comment.