Skip to content

Commit

Permalink
Update for schema promotion
Browse files Browse the repository at this point in the history
Signed-off-by: Muralidhar Basani <[email protected]>
  • Loading branch information
muralibasani committed Feb 28, 2024
1 parent c5845e7 commit 15d412b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
2 changes: 0 additions & 2 deletions coral/types/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,8 +770,6 @@ export type components = {
sourceEnvironment: string;
topicName: string;
schemaVersion: string;
/** @enum {string} */
schemaType: "AVRO" | "JSON";
forceRegister?: boolean;
appName: string;
remarks: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.aiven.klaw.model.requests;

import io.aiven.klaw.model.enums.SchemaType;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Getter;
Expand All @@ -27,8 +26,6 @@ public class SchemaPromotion {
@Pattern(message = "Invalid Schema Version. Pattern [0-9]", regexp = "^[0-9]*$")
private String schemaVersion;

@NotNull private SchemaType schemaType;

private boolean forceRegister;

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public class SchemaRegistryControllerService {

@Autowired private RolesPermissionsControllerService rolesPermissionsControllerService;

private static final String SCHEMA_TYPE = "schemaType";

public SchemaRegistryControllerService(
ClusterApiService clusterApiService, MailUtils mailService) {
this.clusterApiService = clusterApiService;
Expand Down Expand Up @@ -478,6 +480,11 @@ public ApiResponse promoteSchema(SchemaPromotion schemaPromotion) throws Excepti
schemaObjects.get(Integer.valueOf(schemaPromotion.getSchemaVersion()));
// Pretty Print the Json String so that it can be seen clearly in the UI.
schemaRequest.setSchemafull(prettyPrintUglyJsonString((String) schemaObject.get("schema")));
if (schemaObject.containsKey(SCHEMA_TYPE)) {
schemaRequest.setSchemaType(SchemaType.of(schemaObject.get(SCHEMA_TYPE).toString()));
} else {
schemaRequest.setSchemaType(SchemaType.AVRO);
}
// sending request operation type along with function call
return uploadSchema(schemaRequest, RequestOperationType.PROMOTE);
}
Expand Down Expand Up @@ -525,11 +532,6 @@ private SchemaRequestModel buildSchemaRequestFromPromotionRequest(
schemaRequest.setTopicname(schemaPromotion.getTopicName());
schemaRequest.setForceRegister(schemaPromotion.isForceRegister());
schemaRequest.setEnvironment(schemaPromotion.getTargetEnvironment());
if (schemaPromotion.getSchemaType() == null) {
schemaRequest.setSchemaType(SchemaType.AVRO);
} else {
schemaRequest.setSchemaType(schemaPromotion.getSchemaType());
}
return schemaRequest;
}

Expand Down
1 change: 0 additions & 1 deletion core/src/main/resources/static/js/browseAcls.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,6 @@ app.controller("browseAclsCtrl", function($scope, $http, $location, $window) {
promoteSchemaReq['forceRegister'] = $scope.schema.forceRegister;
promoteSchemaReq['appName'] = "App";
promoteSchemaReq['remarks'] = remarks;
promoteSchemaReq['schemaType'] = $scope.schemaDetails.schemaType;

$http({
method: "POST",
Expand Down
6 changes: 1 addition & 5 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6528,10 +6528,6 @@
"type" : "string",
"pattern" : "^[0-9]*$"
},
"schemaType" : {
"type" : "string",
"enum" : [ "AVRO", "JSON" ]
},
"forceRegister" : {
"type" : "boolean"
},
Expand All @@ -6544,7 +6540,7 @@
"pattern" : "^[a-zA-z 0-9]*$"
}
},
"required" : [ "appName", "remarks", "schemaType", "schemaVersion", "sourceEnvironment", "targetEnvironment", "topicName" ]
"required" : [ "appName", "remarks", "schemaVersion", "sourceEnvironment", "targetEnvironment", "topicName" ]
},
"ConsumerOffsetResetRequestModel" : {
"properties" : {
Expand Down

0 comments on commit 15d412b

Please sign in to comment.