Skip to content

Commit

Permalink
chore: refactor schemaId to be an Option[String]
Browse files Browse the repository at this point in the history
Signed-off-by: Yurii Shynbuiev <[email protected]>
  • Loading branch information
yshyn-iohk committed Dec 16, 2024
1 parent 2fb833a commit c9c091f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 98 deletions.
6 changes: 0 additions & 6 deletions cloud-agent/client/kotlin/.openapi-generator-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ src/main/kotlin/org/hyperledger/identus/client/models/DateTimeParameter.kt
src/main/kotlin/org/hyperledger/identus/client/models/DidParameter.kt
src/main/kotlin/org/hyperledger/identus/client/models/VcVerificationParameter.kt

src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequest.kt
src/main/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequestSchemaId.kt

src/test/kotlin/org/hyperledger/identus/client/models/UpdateManagedDIDServiceActionTest.kt
src/test/kotlin/org/hyperledger/identus/client/models/UpdateManagedDIDServiceActionTypeTest.kt

Expand All @@ -29,6 +26,3 @@ src/test/kotlin/org/hyperledger/identus/client/models/ServiceTypeTest.kt
src/test/kotlin/org/hyperledger/identus/client/models/StatusPurposeTest.kt
src/test/kotlin/org/hyperledger/identus/client/models/CredentialSubjectTest.kt

src/test/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequestTest.kt
src/test/kotlin/org/hyperledger/identus/client/models/CreateIssueCredentialRecordRequestSchemaIdTest.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ trait CredentialSchemaReferenceParsingLogic {
// The "type" property in the "credentialSchema" object must be "JsonSchemaValidator2018".
// Multiple schemas are not allowed in VCDM 1.1.
def parseCredentialSchemaRef_VCDM1_1(
deprecatedSchemaIdProperty: Option[String | List[String]],
deprecatedSchemaIdProperty: Option[String],
credentialSchemaRefOption: Option[HTTPCredentialSchemaRef]
): IO[ErrorResponse, DomainCredentialSchemaRef] = {
credentialSchemaRefOption match {
Expand All @@ -31,7 +31,7 @@ trait CredentialSchemaReferenceParsingLogic {
}

def parseSchemaIdForAnonCredsModelV1(
deprecatedSchemaIdProperty: Option[String | List[String]],
deprecatedSchemaIdProperty: Option[String],
schemaIdProperty: Option[String]
): IO[ErrorResponse, UriString] = {
schemaIdProperty
Expand All @@ -40,13 +40,11 @@ trait CredentialSchemaReferenceParsingLogic {
}

private def handleDeprecatedSchemaId(
deprecatedSchemaIdProperty: Option[String | List[String]]
deprecatedSchemaIdProperty: Option[String]
): IO[ErrorResponse, String] = {
deprecatedSchemaIdProperty match {
case Some(schemaId: String) =>
ZIO.succeed(schemaId)
case Some(_: List[String]) =>
ZIO.fail(ErrorResponse.badRequest(detail = Some("Multiple credential schemas are not allowed.")))
case None =>
ZIO.fail(ErrorResponse.badRequest(detail = Some("Credential schema property missed.")))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ final case class CreateIssueCredentialRecordRequest(
@description(annotations.schemaId.description)
@encodedExample(annotations.schemaId.example)
@deprecated("Use anoncredsVcPropertiesV1.schemaId instead", "2.0.0")
schemaId: Option[String | List[String]] = None,
schemaId: Option[String] = None,
@description(annotations.credentialDefinitionId.description)
@encodedExample(annotations.credentialDefinitionId.example)
@deprecated("Use anoncredsVcPropertiesV1.credentialDefinitionId instead", "2.0.0")
Expand Down

0 comments on commit c9c091f

Please sign in to comment.