Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
3749644
define default schema unable null
congbobo Mar 2, 2019
21cf4f4
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 4, 2019
ed46db4
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 5, 2019
8c06348
Modify the Schema default unableNull test
congbobo Mar 5, 2019
0c68e9f
Modify the Schema type not null
congbobo Mar 6, 2019
8241d69
recover the format
congbobo Mar 6, 2019
bbda7b4
Modify the code format
congbobo Mar 6, 2019
5bdc4da
recover the code format
congbobo Mar 6, 2019
f24932e
function topic schema by default allow null need to fix
congbobo Mar 6, 2019
9040c82
Modify the code format
congbobo Mar 6, 2019
ed118b3
Fix the test define schema type AllowNull
congbobo Mar 6, 2019
3070234
fix the test schema type allow null
congbobo Mar 6, 2019
4300123
fix the test schema define AllowNull
congbobo Mar 6, 2019
82c23dd
Fix the test schema type allow null
congbobo Mar 6, 2019
aa6d368
fix test schema type allow null
congbobo Mar 6, 2019
75b9785
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 6, 2019
79167ec
taking an object with the class extraction configuration
congbobo Mar 7, 2019
08f66d2
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 8, 2019
1b2c494
fix the test
congbobo Mar 8, 2019
5e175bb
Remove keyValueSchemaDefinition
congbobo Mar 8, 2019
f41c91a
remove keyValueSchemaDefinition dependency
congbobo Mar 8, 2019
dcb257a
remove dependency
congbobo Mar 8, 2019
cee8290
Modify the system schema config field alwaysAllNull to alwaysAllowNull
congbobo Mar 9, 2019
08e2037
Restore code format
congbobo Mar 9, 2019
0ecfd62
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 9, 2019
435f514
Modify the keyValueSchemaTest
congbobo Mar 9, 2019
227137b
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 11, 2019
de1020e
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 14, 2019
b02504e
add schema defination builder
congbobo Mar 14, 2019
7c78762
delete package dependency
congbobo Mar 14, 2019
7ced54a
delete package dependency
congbobo Mar 14, 2019
96ffcf9
Modify the schema defination of topic schema
congbobo Mar 14, 2019
4ed1db8
Remove the dependency
congbobo Mar 14, 2019
12ba1cb
Modify the test
congbobo Mar 14, 2019
a6df77e
move the ALWAYS_ALLOW_NULL field location
congbobo Mar 14, 2019
0271117
modify the test
congbobo Mar 14, 2019
5e37a97
add schema definition builder
congbobo Mar 15, 2019
4ef4be4
Add genericity
congbobo Mar 15, 2019
ac4f047
modify the test
congbobo Mar 16, 2019
841dad5
modify the test
congbobo Mar 16, 2019
eab205f
modify the test
congbobo Mar 16, 2019
c81f150
Merge remote-tracking branch 'apache/master' into schema_type_notnull
congbobo Mar 16, 2019
7c59bac
remove the dependency
congbobo Mar 17, 2019
36a8977
remove the dependency
congbobo Mar 18, 2019
2c9a5f9
Merge remote-tracking branch 'apache/master' into schema_type_notnull
sijie Mar 19, 2019
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 @@ -31,6 +31,7 @@
import org.apache.pulsar.client.api.PulsarClient;
import org.apache.pulsar.client.api.PulsarClientException;
import org.apache.pulsar.client.api.Schema;
import org.apache.pulsar.client.api.schema.SchemaDefinition;
import org.apache.pulsar.client.impl.PulsarClientImpl;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
Expand All @@ -43,6 +44,8 @@ public class ClientGetSchemaTest extends ProducerConsumerBase {
private static final String topicString = "my-property/my-ns/topic-string";
private static final String topicJson = "my-property/my-ns/topic-json";
private static final String topicAvro = "my-property/my-ns/topic-avro";
private static final String topicJsonNotNull = "my-property/my-ns/topic-json-not-null";
private static final String topicAvroNotNull = "my-property/my-ns/topic-avro-not-null";

List<Producer<?>> producers = new ArrayList<>();

Expand All @@ -62,6 +65,11 @@ protected void setup() throws Exception {
producers.add(pulsarClient.newProducer(Schema.STRING).topic(topicString).create());
producers.add(pulsarClient.newProducer(Schema.AVRO(MyClass.class)).topic(topicAvro).create());
producers.add(pulsarClient.newProducer(Schema.JSON(MyClass.class)).topic(topicJson).create());
producers.add(pulsarClient.newProducer(Schema.AVRO(SchemaDefinition.<MyClass>builder().withPojo(MyClass.class).build())).topic(topicAvro).create());
producers.add(pulsarClient.newProducer(Schema.JSON(SchemaDefinition.<MyClass>builder().withPojo(MyClass.class).build())).topic(topicJson).create());
producers.add(pulsarClient.newProducer(Schema.AVRO(SchemaDefinition.<MyClass>builder().withPojo(MyClass.class).withAlwaysAllowNull(false).build())).topic(topicAvroNotNull).create());
producers.add(pulsarClient.newProducer(Schema.JSON(SchemaDefinition.<MyClass>builder().withPojo(MyClass.class).withAlwaysAllowNull(false).build())).topic(topicJsonNotNull).create());

}

@AfterClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import org.apache.pulsar.client.api.Schema;
import org.apache.pulsar.client.api.SchemaSerializationException;
import org.apache.pulsar.client.api.schema.SchemaDefinition;
import org.apache.pulsar.client.impl.schema.JSONSchema;
import org.apache.pulsar.common.schema.SchemaData;
import org.apache.pulsar.common.schema.SchemaInfo;
Expand All @@ -51,11 +52,11 @@ public SchemaCompatibilityCheck getSchemaCheck() {
public void testJsonSchemaBackwardsCompatibility() throws JsonProcessingException {

SchemaData from = SchemaData.builder().data(OldJSONSchema.of(Foo.class).getSchemaInfo().getSchema()).build();
SchemaData to = SchemaData.builder().data(JSONSchema.of(Foo.class).getSchemaInfo().getSchema()).build();
SchemaData to = SchemaData.builder().data(JSONSchema.of(SchemaDefinition.builder().withPojo(Foo.class).build()).getSchemaInfo().getSchema()).build();
JsonSchemaCompatibilityCheck jsonSchemaCompatibilityCheck = new JsonSchemaCompatibilityCheck();
Assert.assertTrue(jsonSchemaCompatibilityCheck.isCompatible(from, to, SchemaCompatibilityStrategy.FULL));

from = SchemaData.builder().data(JSONSchema.of(Foo.class).getSchemaInfo().getSchema()).build();
from = SchemaData.builder().data(JSONSchema.of(SchemaDefinition.<Foo>builder().withPojo(Foo.class).build()).getSchemaInfo().getSchema()).build();
to = SchemaData.builder().data(OldJSONSchema.of(Foo.class).getSchemaInfo().getSchema()).build();
Assert.assertTrue(jsonSchemaCompatibilityCheck.isCompatible(from, to, SchemaCompatibilityStrategy.FULL));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.pulsar.broker.service.schema.SchemaCompatibilityStrategy;
import org.apache.pulsar.broker.service.schema.SchemaRegistry;
import org.apache.pulsar.client.api.schema.GenericRecord;
import org.apache.pulsar.client.api.schema.SchemaDefinition;
import org.apache.pulsar.client.impl.schema.AvroSchema;
import org.apache.pulsar.client.impl.schema.JSONSchema;
import org.apache.pulsar.client.impl.schema.ProtobufSchema;
Expand Down Expand Up @@ -63,7 +64,7 @@ public void testJsonProducerAndConsumer() throws Exception {
log.info("-- Starting {} test --", methodName);

JSONSchema<JsonEncodedPojo> jsonSchema =
JSONSchema.of(JsonEncodedPojo.class);
JSONSchema.of(SchemaDefinition.<JsonEncodedPojo>builder().withPojo(JsonEncodedPojo.class).build());

Consumer<JsonEncodedPojo> consumer = pulsarClient
.newConsumer(jsonSchema)
Expand Down Expand Up @@ -108,7 +109,7 @@ public void testJsonProducerAndConsumerWithPrestoredSchema() throws Exception {
log.info("-- Starting {} test --", methodName);

JSONSchema<JsonEncodedPojo> jsonSchema =
JSONSchema.of(JsonEncodedPojo.class);
JSONSchema.of(SchemaDefinition.<JsonEncodedPojo>builder().withPojo(JsonEncodedPojo.class).build());

pulsar.getSchemaRegistryService()
.putSchemaIfAbsent("my-property/my-ns/my-topic1",
Expand Down Expand Up @@ -166,7 +167,7 @@ public void testJsonConsumerWithWrongCorruptedSchema() throws Exception {
).get();

Consumer<JsonEncodedPojo> consumer = pulsarClient
.newConsumer(JSONSchema.of(JsonEncodedPojo.class))
.newConsumer(JSONSchema.of(SchemaDefinition.<JsonEncodedPojo>builder().withPojo(JsonEncodedPojo.class).build()))
.topic("persistent://my-property/use/my-ns/my-topic1")
.subscriptionName("my-subscriber-name")
.subscribe();
Expand Down Expand Up @@ -194,7 +195,7 @@ public void testJsonProducerWithWrongCorruptedSchema() throws Exception {
).get();

Producer<JsonEncodedPojo> producer = pulsarClient
.newProducer(JSONSchema.of(JsonEncodedPojo.class))
.newProducer(JSONSchema.of(SchemaDefinition.<JsonEncodedPojo>builder().withPojo(JsonEncodedPojo.class).build()))
.topic("persistent://my-property/use/my-ns/my-topic1")
.create();

Expand Down Expand Up @@ -273,7 +274,9 @@ public void testProtobufConsumerWithWrongPrestoredSchema() throws Exception {
).get();

Consumer<org.apache.pulsar.client.api.schema.proto.Test.TestMessageWrong> consumer = pulsarClient
.newConsumer(AvroSchema.of(org.apache.pulsar.client.api.schema.proto.Test.TestMessageWrong.class))
.newConsumer(AvroSchema.of
(SchemaDefinition.<org.apache.pulsar.client.api.schema.proto.Test.TestMessageWrong>builder().
withPojo(org.apache.pulsar.client.api.schema.proto.Test.TestMessageWrong.class).build()))
.topic("persistent://my-property/use/my-ns/my-topic1")
.subscriptionName("my-subscriber-name")
.subscribe();
Expand All @@ -286,7 +289,8 @@ public void testAvroProducerAndConsumer() throws Exception {
log.info("-- Starting {} test --", methodName);

AvroSchema<AvroEncodedPojo> avroSchema =
AvroSchema.of(AvroEncodedPojo.class);
AvroSchema.of(SchemaDefinition.<AvroEncodedPojo>builder().
withPojo(AvroEncodedPojo.class).build());

Consumer<AvroEncodedPojo> consumer = pulsarClient
.newConsumer(avroSchema)
Expand Down Expand Up @@ -355,7 +359,8 @@ public void testAvroConsumerWithWrongPrestoredSchema() throws Exception {
).get();

Consumer<AvroEncodedPojo> consumer = pulsarClient
.newConsumer(AvroSchema.of(AvroEncodedPojo.class))
.newConsumer(AvroSchema.of(SchemaDefinition.<AvroEncodedPojo>builder().
withPojo(AvroEncodedPojo.class).build()))
.topic("persistent://my-property/use/my-ns/my-topic1")
.subscriptionName("my-subscriber-name")
.subscribe();
Expand Down Expand Up @@ -454,7 +459,8 @@ public void testAvroProducerAndAutoSchemaConsumer() throws Exception {
log.info("-- Starting {} test --", methodName);

AvroSchema<AvroEncodedPojo> avroSchema =
AvroSchema.of(AvroEncodedPojo.class);
AvroSchema.of(SchemaDefinition.<AvroEncodedPojo>builder().
withPojo(AvroEncodedPojo.class).build());

Producer<AvroEncodedPojo> producer = pulsarClient
.newProducer(avroSchema)
Expand Down Expand Up @@ -502,7 +508,8 @@ public void testAvroProducerAndAutoSchemaReader() throws Exception {
log.info("-- Starting {} test --", methodName);

AvroSchema<AvroEncodedPojo> avroSchema =
AvroSchema.of(AvroEncodedPojo.class);
AvroSchema.of(SchemaDefinition.<AvroEncodedPojo>builder().
withPojo(AvroEncodedPojo.class).build());

Producer<AvroEncodedPojo> producer = pulsarClient
.newProducer(avroSchema)
Expand Down Expand Up @@ -548,7 +555,8 @@ public void testAutoBytesProducer() throws Exception {
log.info("-- Starting {} test --", methodName);

AvroSchema<AvroEncodedPojo> avroSchema =
AvroSchema.of(AvroEncodedPojo.class);
AvroSchema.of(SchemaDefinition.<AvroEncodedPojo>builder().
withPojo(AvroEncodedPojo.class).build());

try (Producer<AvroEncodedPojo> producer = pulsarClient
.newProducer(avroSchema)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
package org.apache.pulsar.client.api;

import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.Map;

import org.apache.pulsar.client.api.schema.GenericRecord;
import org.apache.pulsar.client.api.schema.GenericSchema;
import org.apache.pulsar.client.api.schema.SchemaDefinition;
import org.apache.pulsar.client.internal.DefaultImplementation;
import org.apache.pulsar.common.schema.KeyValue;
import org.apache.pulsar.common.schema.SchemaInfo;
Expand Down Expand Up @@ -169,58 +169,43 @@ static <T extends com.google.protobuf.GeneratedMessageV3> Schema<T> PROTOBUF(Cla
}

/**
* Create a Avro schema type by extracting the fields of the specified class.
*
* @param clazz the POJO class to be used to extract the Avro schema
* @return a Schema instance
*/
static <T> Schema<T> AVRO(Class<T> clazz) {
return DefaultImplementation.newAvroSchema(clazz);
}

/**
* Create a Avro schema type using the provided avro schema definition.
* Create a Avro schema type by default configuration of the class
*
* @param schemaDefinition avro schema definition
* @param pojo the POJO class to be used to extract the Avro schema
* @return a Schema instance
*/
static <T> Schema<T> AVRO(String schemaDefinition) {
return AVRO(schemaDefinition, Collections.emptyMap());
static <T> Schema<T> AVRO(Class<T> pojo) {
return DefaultImplementation.newAvroSchema(SchemaDefinition.builder().withPojo(pojo).build());
}

/**
* Create a Avro schema type using the provided avro schema definition.
* Create a Avro schema type with schema definition
*
* @param schemaDefinition avro schema definition
* @param properties pulsar schema properties
* @param schemaDefinition the definition of the schema
* @return a Schema instance
*/
static <T> Schema<T> AVRO(String schemaDefinition, Map<String, String> properties) {
return DefaultImplementation.newAvroSchema(schemaDefinition, properties);
static <T> Schema<T> AVRO(SchemaDefinition<T> schemaDefinition) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having the SchemaDefinition<T>, what about leaving the pojo and adding the options like:

Schema.AVRO(MyObject.class, AvroDefinition.builder().allowNull(false).build());

This could be extended in #3766 with:

Schema.AVRO(MyObject.class, AvroDefinition.fromSchema("...json definition..."));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think AvroDefinition is a good name. it is confusing - does it mean it is for avro schema, or it is for generated the avro formatted schema. I think SchemaDefinition is much better.

If we agree on SchemaDefinition, pojo class is better to be part of it. that means the schema definition is generated from pojo. if pojo class is omitted, the schema definition is generated from the json string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think AvroDefinition is a good name. it is confusing - does it mean it is for avro schema, or it is for generated the avro formatted schema. I think SchemaDefinition is much better.

Sure that's probably not a good naming. Though I'd be careful in using constructor approach since it makes it harder to extend, compared to using builder pattern.

if pojo class is omitted, the schema definition is generated from the json string.

Ok that would make the Producer<Object> which should still be fine (in the Avro case) since the avro schema is the one that is really deciding the serialization.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay If I understand this correctly, the comment is changing the SchemaDefinition to use a builder pattern. correct?

return DefaultImplementation.newAvroSchema(schemaDefinition);
}

/**
* Create a JSON schema type by extracting the fields of the specified class.
*
* @param clazz the POJO class to be used to extract the JSON schema
* @param pojo the POJO class to be used to extract the JSON schema
* @return a Schema instance
*/
static <T> Schema<T> JSON(Class<T> clazz) {
return DefaultImplementation.newJSONSchema(clazz);
static <T> Schema<T> JSON(Class<T> pojo) {
return DefaultImplementation.newJSONSchema(SchemaDefinition.builder().withPojo(pojo).build());
}

/**
* Create a JSON schema type by extracting the fields of the specified class.
* Create a JSON schema type with schema definition
*
* @param clazz the POJO class to be used to extract the JSON schema
* @param schemaDefinition schema definition json string (using avro schema syntax)
* @param properties pulsar schema properties
* @param schemaDefinition the definition of the schema
* @return a Schema instance
*/
static <T> Schema<T> JSON(Class<T> clazz,
String schemaDefinition,
Map<String, String> properties) {
return DefaultImplementation.newJSONSchema(clazz, schemaDefinition, properties);
static <T> Schema<T> JSON(SchemaDefinition schemaDefinition) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that JSON is a bit different compared with AVRO in that it does not have a canonical schema representation. In AVRO, the schema def is the source of truth, but for JSON the pojo is typically the source of truth (and people use annotations to customize the specific fields).

For now I'd prefer to not add it. We can always add it later if there are good reasons for it (but we'd not be able to take it out once it's in there).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AllowNull probably doesn't make a lot sense to JSON. but having the ability to create a schema definition is good for query engines using pulsar. so I would prefer keeping it for consistency as AVRO, as it would allow people to customize how schema is generated.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A part from having this difference in the allow null, I think there is a more fundamental difference between JSON and AVRO.

In JSON, the AVRO schema is extracted and used for the validation, but the JSON serialization is done separately. In this case the POJO and the serialized data could be different from the Avro schema that was validated with broker.

That's not a problem with Avro since the schema object is used at serialization time so it doesn't matter which POJO we're passing there that the result will be correct (or user gets exception).

For this I'm suggesting to avoid adding the option for JSON right now and defer it until there's a clear use case for it (adding is always easy).

My guess is that this will probably not be needed as users will not already have a precise Avro schema representation for the data used in other systems. Rather, it's common practice in most languages to define POJOs for the JSON data.

@sijie sijie Mar 13, 2019

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed with @merlimat offline about this. Both of us agree on having the same SchemaDefinition for both JSON and Avro, but make clear what are the use cases for these methods.

The SchemaDefinition (e.g. AllowNull or schema string in #3766) for JSON probably looks not useful initially. But this is useful for an integration between Pulsar and other data systems with their own schema systems (e.g. Hive). The schema is usually defined and generated by GenericSchemaBuilder by converting the metadata definition from other system into pulsar's schema system in program. The generated schema will be used as source-of-truth for being consistent across pulsar and other data systems. So we need a mechanism for this generated schema to be attached to JSON schema when it is used in a POJO form. Otherwise if we don't do so, the schema parsed from POJO might not exactly have the constraints that we converted from other schema systems. And it will cause incompatible schema exceptions.

With that being said, we will keep SchemaDefinition for Schema.JSON in this PR, so it can be used in #3766. But we need to change SchemaDefinition to a builder pattern to allow extensibility. /cc @congbobo184

@merlimat please correct me if I missed anything from our conversation.

return DefaultImplementation.newJSONSchema(schemaDefinition);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.client.api.schema;

import org.apache.pulsar.client.internal.DefaultImplementation;

import java.util.Map;


public interface SchemaDefinition<T> {

/**
* Get a new builder instance that can used to configure and build a {@link SchemaDefinition} instance.
*
* @return the {@link SchemaDefinition}
*/
static <T> SchemaDefinitionBuilder<T> builder() {
return DefaultImplementation.newSchemaDefinitionBuilder();
}

/**
* get schema whether always allow null or not
*
* @return schema always null or not
*/
public boolean getAlwaysAllowNull();

/**
* Get schema class
*
* @return schema class
*/
public Map<String, String> getProperties();

/**
* Get json schema definition
*
* @return schema class
*/
public String getJsonDef();

/**
* Get pojo schema definition
*
* @return pojo schema
*/
public Class<T> getPojo();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pulsar.client.api.schema;



import java.util.Map;

/**
* Builder to build schema definition {@link SchemaDefinition}.
*/
public interface SchemaDefinitionBuilder<T> {

/**
* Set schema whether always allow null or not
*
* @param alwaysAllowNull definition null or not
* @return schema definition builder
*/
SchemaDefinitionBuilder<T> withAlwaysAllowNull(boolean alwaysAllowNull);

/**
* Set schema info properties
*
* @param properties schema info properties
* @return schema definition builder
*/
SchemaDefinitionBuilder<T> withProperties(Map<String, String> properties);

/**
* Set schema info properties
*
* @param key property key
* @param value property value
*
* @return record schema definition
*/
SchemaDefinitionBuilder<T> addProperty(String key, String value);

/**
* Set schema of pojo definition
*
* @param pojo pojo schema definition
*
* @return record schema definition
*/
SchemaDefinitionBuilder<T> withPojo(Class pojo);

/**
* Set schema of json definition
*
* @param jsonDefinition json schema definition
*
* @return record schema definition
*/
SchemaDefinitionBuilder<T> withJsonDef(String jsonDefinition);

/**
* Build the schema definition.
*
* @return the schema definition.
*/
SchemaDefinition<T> build();

}
Loading