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;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.provectus.kafka.ui.model.NewSchemaSubject;
|
||||
import com.provectus.kafka.ui.model.SchemaType;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -11,8 +10,8 @@ public class InternalNewSchema {
|
|||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
private SchemaType schemaType;
|
||||
|
||||
public InternalNewSchema(NewSchemaSubject schemaSubject) {
|
||||
this.schema = schemaSubject.getSchema();
|
||||
this.schemaType = schemaSubject.getSchemaType();
|
||||
public InternalNewSchema(String schema, SchemaType schemaType) {
|
||||
this.schema = schema;
|
||||
this.schemaType = schemaType;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -161,7 +161,8 @@ public class SchemaRegistryService {
|
|||
public Mono<SchemaSubject> registerNewSchema(String clusterName, Mono<NewSchemaSubject> newSchemaSubject) {
|
||||
return newSchemaSubject
|
||||
.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();
|
||||
return clustersStorage.getClusterByName(clusterName)
|
||||
.map(KafkaCluster::getSchemaRegistry)
|
||||
|
|
|
@ -1381,6 +1381,7 @@ components:
|
|||
required:
|
||||
- subject
|
||||
- schema
|
||||
- schemaType
|
||||
|
||||
CompatibilityLevel:
|
||||
type: object
|
||||
|
|
Loading…
Add table
Reference in a new issue