Below is the avro schema I'm using with SBB 3.3.2

{
"type": "record",
"name": "AvroSchema",
"namespace": "com.programs.avro.v1",
"fields": [
{
"name": "projPrograms",
"type": {
"type": "array",
"items": {
"type": "record",
"name": "AvroProgramDto",
"namespace": "com.programs.avro.v1",
"fields": [
{
"name": "enrollmentId",
"type": "string"
},
{
"name": "externalStatus",
"type": [
"null",
"string"
]
},
{
"name": "reasonCode",
"type": [
"null",
"string"
]
},
{
"name": "memo",
"type": [
"null",
"string"
]
} 
]
}
}
}
]
}

For nullable fields when I give a value and publish this message, I’m seeing those nullable fields as
“externalStatus”:{“string”:“A”},“reasonCode”:{“string”:“43”},“memo”:{“string”:“Enrolled”}. But it shouldn’t have the datatype “string” included in value. How can I resolve this

Hi @ART_09 ,

Can give more information.

  1. Message that you are publishing ?
  2. Are you using avro libraries for serialisation before publishing the message ?
  3. Sample code where you are serialising your message, creating PubsubMessage and publishing the message ?

this is my dto
class ProjPrograms {

@JsonProperty(“enrollmentId”)
private String enrollmentId;
@JsonProperty (“externalStatus”)
private String externalStatus;
@JsonProperty(“reasonCode”)
private String reasonCode;
@JsonProperty(“memo”)
private String memo;
}

below is my pubsub publisher code

private AvroMessagePublisher avroMessagePublisher;
AvroProjProgramsSchema avroMessage = convertToAvro(projProgramsDto)
AvroMessageContext avroMessageContext = AvroMessageContext.builder()
        .setAvroMessage(avroMessage)
        .build();
avroMessagePublisher.publishAvroMessage(avroMessageContext); //publishAvroMessage is a pre-defined method in AvroMessagePublisher. Dependency is springBoot Publisher

privateAvroProjProgramsSchema convertToAvro(ProjProgramsDto) {
AvroProjProgramsSchema avroProjProgramsSchema =  new AvroProjProgramsSchema();
//here I'm explict conversion of projProgramsDto to avroProjProgramsSchema
return avroProjProgramsSchema;
}