Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fireblocks.sdk.JSON;
import java.io.IOException;
import java.util.Collections;
Expand Down Expand Up @@ -78,6 +79,8 @@ public TokenLinkDtoTokenMetadata deserialize(JsonParser jp, DeserializationConte
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
ObjectMapper objectMapper = new ObjectMapper();

// deserialize AssetMetadataDto
try {
boolean attemptParsing = true;
Expand Down Expand Up @@ -108,10 +111,7 @@ public TokenLinkDtoTokenMetadata deserialize(JsonParser jp, DeserializationConte
}
}
if (attemptParsing) {
deserialized = tree.traverse(jp.getCodec()).readValueAs(AssetMetadataDto.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
deserialized = objectMapper.readValue(tree.traverse(jp.getCodec()), AssetMetadataDto.class);
match++;
log.log(Level.FINER, "Input data matches schema 'AssetMetadataDto'");
}
Expand Down Expand Up @@ -150,11 +150,7 @@ public TokenLinkDtoTokenMetadata deserialize(JsonParser jp, DeserializationConte
}
}
if (attemptParsing) {
deserialized =
tree.traverse(jp.getCodec()).readValueAs(CollectionMetadataDto.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
deserialized = objectMapper.readValue(tree.traverse(jp.getCodec()), CollectionMetadataDto.class);
match++;
log.log(Level.FINER, "Input data matches schema 'CollectionMetadataDto'");
}
Expand Down Expand Up @@ -193,11 +189,7 @@ public TokenLinkDtoTokenMetadata deserialize(JsonParser jp, DeserializationConte
}
}
if (attemptParsing) {
deserialized =
tree.traverse(jp.getCodec()).readValueAs(ContractMetadataDto.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
deserialized = objectMapper.readValue(tree.traverse(jp.getCodec()), ContractMetadataDto.class);
match++;
log.log(Level.FINER, "Input data matches schema 'ContractMetadataDto'");
}
Expand Down