question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Having record builder using JSON schema

See original GitHub issue

I am trying to build a generic record from JSON schema dynamically using SchemaBuilder and RecordBuilder. Below is the code snippet

` val recordBuilder = SchemaBuilder.record(“testJson”)

recordBuilder.field("eventType").type(SchemaType.STRING)
val si: SchemaInfo = recordBuilder.build(SchemaType.JSON)
val pulsarSchema = org.apache.pulsar.client.api.Schema.generic(si)

val builder: GenericRecordBuilder = pulsarSchema.newRecordBuilder()
builder.set("eventType", "test")
val pulsarGenericRecord: GenericRecord = builder.build()`

And got this exeception (Pulsar version 2.6.1)

Json Schema doesn't support record builder yet java.lang.UnsupportedOperationException: Json Schema doesn't support record builder yet at org.apache.pulsar.client.impl.schema.generic.GenericJsonSchema.newRecordBuilder(GenericJsonSchema.java:78)

Is there other way to build this generic record from JSON schema other than using static POJO ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
hanguyen6commented, Feb 4, 2021

@codelipenghui thanks for confirmation. Is there other way I can build record dynamically using json schema ?

0reactions
codelipenghuicommented, Mar 4, 2022

The issue had no activity for 30 days, mark with Stale label.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SchemaBuilder (Apache Avro Java 1.7.6 API)
A fluent interface for building Schema instances. The flow of the API is designed to mimic the Avro Schema Specification. For example, the...
Read more >
Using JSON Schema to Save Lives - YouTube
Find out how to save lives by replacing a life-critical legacy healthcare system with a data-first approach.Come hear how we leverage a JSON...
Read more >
JSON Schema Serializer and Deserializer
Plug the KafkaJsonSchemaSerializer into KafkaProducer to send messages of JSON Schema type to Kafka. Assuming you have a Java class that is decorated...
Read more >
Create forms using the JSON Schema Form component
This guide walks you through building an app and form using JSON Schema Form. You can fill in the form to create a...
Read more >
JSON Schema Examples Tutorial - MongoDB
The schema that we have used in the above section is a basic outline. Lets build on it by adding an id field...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found