Set schemaType is required and ignore when submitting to Schema Registry if it's NULL
This commit is contained in:
parent
b572a6e866
commit
12b77eff17
3 changed files with 6 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
||||||
package com.provectus.kafka.ui.cluster.model.schemaregistry;
|
package com.provectus.kafka.ui.cluster.model.schemaregistry;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.provectus.kafka.ui.model.NewSchemaSubject;
|
|
||||||
import com.provectus.kafka.ui.model.SchemaType;
|
import com.provectus.kafka.ui.model.SchemaType;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ -11,8 +10,8 @@ public class InternalNewSchema {
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
private SchemaType schemaType;
|
private SchemaType schemaType;
|
||||||
|
|
||||||
public InternalNewSchema(NewSchemaSubject schemaSubject) {
|
public InternalNewSchema(String schema, SchemaType schemaType) {
|
||||||
this.schema = schemaSubject.getSchema();
|
this.schema = schema;
|
||||||
this.schemaType = schemaSubject.getSchemaType();
|
this.schemaType = schemaType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,8 @@ public class SchemaRegistryService {
|
||||||
public Mono<SchemaSubject> registerNewSchema(String clusterName, Mono<NewSchemaSubject> newSchemaSubject) {
|
public Mono<SchemaSubject> registerNewSchema(String clusterName, Mono<NewSchemaSubject> newSchemaSubject) {
|
||||||
return newSchemaSubject
|
return newSchemaSubject
|
||||||
.flatMap(schema -> {
|
.flatMap(schema -> {
|
||||||
Mono<InternalNewSchema> newSchema = Mono.just(new InternalNewSchema(schema));
|
SchemaType schemaType = SchemaType.AVRO == schema.getSchemaType() ? null : schema.getSchemaType();
|
||||||
|
Mono<InternalNewSchema> newSchema = Mono.just(new InternalNewSchema(schema.getSchema(), schemaType));
|
||||||
String subject = schema.getSubject();
|
String subject = schema.getSubject();
|
||||||
return clustersStorage.getClusterByName(clusterName)
|
return clustersStorage.getClusterByName(clusterName)
|
||||||
.map(KafkaCluster::getSchemaRegistry)
|
.map(KafkaCluster::getSchemaRegistry)
|
||||||
|
|
|
@ -1381,6 +1381,7 @@ components:
|
||||||
required:
|
required:
|
||||||
- subject
|
- subject
|
||||||
- schema
|
- schema
|
||||||
|
- schemaType
|
||||||
|
|
||||||
CompatibilityLevel:
|
CompatibilityLevel:
|
||||||
type: object
|
type: object
|
||||||
|
|
Loading…
Add table
Reference in a new issue