Skip to content

Is this code reasonable in GenericJsonSchema.java ? #4294

@ppgoml

Description

@ppgoml

/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericJsonSchema.java

public byte[] encode(GenericRecord message) {
checkArgument(message instanceof GenericAvroRecord);
GenericJsonRecord gjr = (GenericJsonRecord) message;
try {
return objectMapper.writeValueAsBytes(gjr.getJsonNode().toString());
} catch (IOException ioe) {
throw new SchemaSerializationException(ioe);
}
}

I don't understand why there is a GenericAvroRecord check here in Json schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecated/questionQuestions should happened in GitHub Discussions

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions