Skip to content

Commit

Permalink
Merge branch '7.1.x' into pr_merge_from_7_0_x_to_7_1_x
Browse files Browse the repository at this point in the history
  • Loading branch information
Anshul-Goyal authored May 30, 2022
2 parents 40ca7ab + 73733c0 commit 0d89c37
Show file tree
Hide file tree
Showing 65 changed files with 2,591 additions and 1,762 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,6 @@ Thanks for helping us to make Schema Registry even better!
License
-------

The project is licensed under the [Confluent Community License](LICENSE-ConfluentCommunity), except for client libs,
which is under the [Apache 2.0 license](LICENSE-Apache).
The project is licensed under the [Confluent Community License](LICENSE-ConfluentCommunity), except for the `client` and `avro-*` libs,
which are under the [Apache 2.0 license](LICENSE-Apache).
See LICENSE file in each subfolder for detailed license agreement.
2 changes: 1 addition & 1 deletion avro-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<licenses>
Expand Down
2 changes: 1 addition & 1 deletion avro-data/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,30 +169,6 @@ public void testNestedUnion() {
avroData.fromConnectSchema(connectSchema);
}

@Test
public void testArrayOfRecordsWithDefaultValue() throws IOException
{
Schema avroSchema =
new Parser().parse(new File("src/test/avro/ArrayOfRecordsWithDefault.avsc"));

org.apache.kafka.connect.data.Schema connectSchema = avroData.toConnectSchema(avroSchema);

Object object = connectSchema.field("records").schema().defaultValue();

Assert.assertTrue(object instanceof List);

List arrayList = (List) object;
Assert.assertEquals(arrayList.size(), 2);

Struct item1 = (Struct) arrayList.get(0);
Assert.assertEquals(item1.get("itemName"), "item1");
Assert.assertEquals(item1.get("itemValue"), "value1");

Struct item2 = (Struct) arrayList.get(1);
Assert.assertEquals(item2.get("itemName"), "item2");
Assert.assertEquals(item2.get("itemValue"), "value2");
}

@Union({MyImpl1.class, MyImpl2.class})
interface MyInterface {}
static class MyImpl1 implements MyInterface
Expand Down Expand Up @@ -383,6 +359,30 @@ public void testRepeatedTypeWithDefaultWithoutConnectMetaData() throws IOExcepti
Assert.assertNull(outputAvroSchema.getField("enumFieldWithDiffDefault").schema().getEnumDefault());
}

@Test
public void testArrayOfRecordsWithDefaultValue() throws IOException
{
Schema avroSchema =
new Parser().parse(new File("src/test/avro/ArrayOfRecordsWithDefault.avsc"));

org.apache.kafka.connect.data.Schema connectSchema = avroData.toConnectSchema(avroSchema);

Object object = connectSchema.field("records").schema().defaultValue();

Assert.assertTrue(object instanceof List);

List arrayList = (List) object;
Assert.assertEquals(arrayList.size(), 2);

Struct item1 = (Struct) arrayList.get(0);
Assert.assertEquals(item1.get("itemName"), "item1");
Assert.assertEquals(item1.get("itemValue"), "value1");

Struct item2 = (Struct) arrayList.get(1);
Assert.assertEquals(item2.get("itemName"), "item2");
Assert.assertEquals(item2.get("itemValue"), "value2");
}

/**
* Test the discard.type.doc.default flag restores old behavior. Avro field doc maps to connect schema
* doc in both way conversion and type doc will be dropped.
Expand Down Expand Up @@ -475,4 +475,4 @@ public void testDiscardTypeDefault() throws IOException {
Assert.assertNull(outputAvroSchema.getField("enumFieldWithoutDefault").defaultVal());
}

}
}
2 changes: 1 addition & 1 deletion avro-serde/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<licenses>
Expand Down
2 changes: 1 addition & 1 deletion avro-serializer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<licenses>
Expand Down
2 changes: 1 addition & 1 deletion benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<artifactId>kafka-schema-registry-benchmark</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ public static Object makeRecord(ParsedSchema schema) throws IOException {
}

static class Record {
Record() {}
Record() {

}

Record(String f1) {
this.f1 = f1;
Expand Down
2 changes: 1 addition & 1 deletion client-console-scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<licenses>
Expand Down
20 changes: 2 additions & 18 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>io.confluent</groupId>
<artifactId>kafka-schema-registry-parent</artifactId>
<version>7.0.4-0</version>
<version>7.1.2-0</version>
</parent>

<licenses>
Expand Down Expand Up @@ -60,28 +60,12 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-core</artifactId>
<version>1.6.2</version>
<exclusions>
<exclusion>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/*
* Copyright 2020 Confluent Inc.
* Copyright 2021 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
* Licensed 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.confluent.io/confluent-community-license
* 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 OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* 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 io.confluent.kafka.schemaregistry.annotations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/*
* Copyright 2020 Confluent Inc.
* Copyright 2021 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
* Licensed 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.confluent.io/confluent-community-license
* 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 OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* 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 io.confluent.kafka.schemaregistry.annotations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
/*
* Copyright 2018 Confluent Inc.
* Copyright 2021 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
* Licensed 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.confluent.io/confluent-community-license
* 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 OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
* 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 io.confluent.kafka.schemaregistry.avro;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.v3.oas.annotations.media.Schema;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = "Config")
public class Config {

private String compatibilityLevel;
Expand All @@ -35,7 +36,7 @@ public Config() {
compatibilityLevel = null;
}

@ApiModelProperty(value = "Compatability Level",
@Schema(description = "Compatibility Level",
allowableValues = "BACKWARD, BACKWARD_TRANSITIVE, FORWARD, FORWARD_TRANSITIVE, FULL, "
+ "FULL_TRANSITIVE, NONE")
@JsonProperty("compatibilityLevel")
Expand All @@ -59,22 +60,16 @@ public boolean equals(Object o) {

Config that = (Config) o;

if (!this.compatibilityLevel.equals(that.compatibilityLevel)) {
return false;
}
return true;
return this.compatibilityLevel.equals(that.compatibilityLevel);
}

@Override
public int hashCode() {
int result = 31 * compatibilityLevel.hashCode();
return result;
return 31 * compatibilityLevel.hashCode();
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{compatibilityLevel=" + this.compatibilityLevel + "}");
return sb.toString();
return "{compatibilityLevel=" + this.compatibilityLevel + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,19 @@
import java.io.IOException;

import io.confluent.kafka.schemaregistry.utils.JacksonMapper;
import io.swagger.v3.oas.annotations.media.Schema;

import java.util.Objects;

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
@Schema(description = Mode.MODE_DESC)
public class Mode {

public static final String MODE_DESC = "Schema Registry operating mode";

@Schema(description = MODE_DESC,
allowableValues = "READWRITE, READONLY, READONLY_OVERRIDE, IMPORT")
private String mode;

public static Mode fromJson(String json) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,16 @@

@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonIgnoreProperties(ignoreUnknown = true)
@io.swagger.v3.oas.annotations.media.Schema(description = "Schema")
public class Schema implements Comparable<Schema> {

public static final String SUBJECT_DESC = "Name of the subject";
public static final String VERSION_DESC = "Version number";
public static final String ID_DESC = "Globally unique identifier of the schema";
public static final String TYPE_DESC = "Schema type";
public static final String REFERENCES_DESC = "References to other schemas";
public static final String SCHEMA_DESC = "Schema definition string";

private String subject;
private Integer version;
private Integer id;
Expand All @@ -53,6 +61,7 @@ public Schema(@JsonProperty("subject") String subject,
this.schema = schema;
}

@io.swagger.v3.oas.annotations.media.Schema(description = SUBJECT_DESC)
@JsonProperty("subject")
public String getSubject() {
return subject;
Expand All @@ -63,6 +72,7 @@ public void setSubject(String subject) {
this.subject = subject;
}

@io.swagger.v3.oas.annotations.media.Schema(description = VERSION_DESC)
@JsonProperty("version")
public Integer getVersion() {
return this.version;
Expand All @@ -73,6 +83,7 @@ public void setVersion(Integer version) {
this.version = version;
}

@io.swagger.v3.oas.annotations.media.Schema(description = ID_DESC)
@JsonProperty("id")
public Integer getId() {
return this.id;
Expand All @@ -83,6 +94,7 @@ public void setId(Integer id) {
this.id = id;
}

@io.swagger.v3.oas.annotations.media.Schema(description = TYPE_DESC)
@JsonProperty("schemaType")
@JsonSerialize(converter = SchemaTypeConverter.class)
public String getSchemaType() {
Expand All @@ -94,6 +106,7 @@ public void setSchemaType(String schemaType) {
this.schemaType = schemaType;
}

@io.swagger.v3.oas.annotations.media.Schema(description = REFERENCES_DESC)
@JsonProperty("references")
public List<SchemaReference> getReferences() {
return this.references;
Expand All @@ -104,6 +117,7 @@ public void setReferences(List<SchemaReference> references) {
this.references = references;
}

@io.swagger.v3.oas.annotations.media.Schema(description = SCHEMA_DESC)
@JsonProperty("schema")
public String getSchema() {
return this.schema;
Expand Down
Loading

0 comments on commit 0d89c37

Please sign in to comment.