Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Fixed an issue with the DID serialization
Browse files Browse the repository at this point in the history
- Updated tests
  • Loading branch information
r-marques committed Sep 25, 2020
1 parent a123775 commit 8fed4d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/io/keyko/nevermined/models/DID.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.keyko.nevermined.models;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.keyko.common.helpers.CryptoHelper;
import io.keyko.common.helpers.EthereumHelper;
import io.keyko.nevermined.exceptions.DIDFormatException;
Expand All @@ -11,7 +11,6 @@
@JsonIgnoreProperties(ignoreUnknown = true)
public class DID {

@JsonProperty
public String did;

public static final String PREFIX = "did:nv:";
Expand Down Expand Up @@ -42,6 +41,7 @@ public static DID getFromHash(String hash) throws DIDFormatException {
return new DID(PREFIX + hash);
}

@JsonValue
public String getDid() {
return did;
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/io/keyko/nevermined/models/DDOTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ public void checkDateFormat() throws Exception {

@Test
public void testWorkflow() throws Exception {
// This tests both serialization and deserialization
DDO ddo = DDO.fromJSON(new TypeReference<DDO>() {}, DDO_JSON_WORKFLOW_CONTENT);
String ddoJson = ddo.toJson(ddo);
ddo = DDO.fromJSON(new TypeReference<DDO>() {
}, ddoJson);

Service metadataService = ddo.getMetadataService();

Expand Down

0 comments on commit 8fed4d0

Please sign in to comment.