Hi, I am trying to emit a custom aspect using a Ja...
# getting-started
s
Hi, I am trying to emit a custom aspect using a Java Emitter in my spring boot application. However, I keep running into the RestLiServiceException, I guess this has something to do with the way I have formulated my request. Can someone please help me through this?
Copy code
{"exceptionClass":"com.linkedin.restli.server.RestLiServiceException","stackTrace":"com.linkedin.restli.server.RestLiServiceException [HTTP Status:422]: Failed to validate record with class 
models.TicketProperties: ERROR :: /value :: unrecognized field found but not allowed\nERROR :: /contentType :: unrecognized field found but not allowed\nERROR :: /ticket_properties :: field is required but not found and has no default value\n\n\tat com.linkedin.metadata.resources.entity.AspectResource.lambda$ingestProposal$3(AspectResource.java:200)\n\tat com.linkedin.metadata.restli.RestliUtil.toTask(RestliUtil.java:30)\n\tat 
...........
I am formulating my MCPW like this:
Copy code
MetadataChangeProposalWrapper mcpw = MetadataChangeProposalWrapper.builder()
    .entityType("dataset")
    .entityUrn("urn:li:dataset:(urn:li:dataPlatform:my_platform,foo,TEST)")
    .upsert()
    .aspect(new GenericAspect().setContentType("application/json").setValue(byteString))
    .aspectName("ticketTabular")
    .build();
The byteString is generated as follows:
Copy code
ObjectNode jsonObject = objectMapper.createObjectNode();
jsonObject.set("ticket_properties", objectMapper.valueToTree(properties));
String jsonObjectString = objectMapper.writeValueAsString(jsonObject);
ByteString byteString = ByteString.copyString(jsonObjectString, StandardCharsets.UTF_8);
1
d
Hi, please avoid cross-posting on multiple channels since it’s against our community guidelines. we’ll follow you up in the ohter thread! 🙂
b
You can view our Slack Gluidelines here: https://datahubproject.io/docs/slack/