Repository: provectus/kafka-ui
Issue: Make a separate endpoint for updating schemas
Labels: type/enhancement
status/wontfix
scope/backend

Currently there's just one endpoint for both creating and updating a schema. Schema type param shouldn't be available when updating an existing schema.

Issue comments:
#2152
Can I work on this please @Haarolean  ?
@shubhwip sure!
@Haarolean Having looked at #2152 I think we can solve this problem just by disabling the `schema type` during edit. This way we can stop users to change schema type during schema edit :).
Also I checked if there is any PUT endpoint on schema registry service but seems like there is nothing.
https://docs.confluent.io/platform/current/schema-registry/develop/api.html#subjects

Submitted the PR for the above change #2495

wontfix: https://github.com/provectus/kafka-ui/pull/2495#issuecomment-1231478236

Pull request review comments:
```suggestion
          description: upon updating a schema, the type of an existing schema can't be changed
```
made it a bit clearer
```suggestion
      description: upon updating a schema, the type of an existing schema can't be changed
```
```suggestion
      description: should be set for creating/updating schema subject
```

Patch that resolved the issue:
diff --git a/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml b/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml
index c603b9dcc90..f64d8ce4da7 100644
--- a/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml
+++ b/kafka-ui-contract/src/main/resources/swagger/kafka-ui-api.yaml
@@ -898,7 +898,7 @@ paths:
     post:
       tags:
         - Schemas
-      summary: create a new subject schema
+      summary: create a new subject schema or update existing subject schema
       operationId: createNewSchema
       parameters:
         - name: clusterName
@@ -2594,6 +2594,7 @@ components:
 
     NewSchemaSubject:
       type: object
+      description: should be set for creating/updating schema subject
       properties:
         subject:
           type: string
@@ -2601,6 +2602,7 @@ components:
           type: string
         schemaType:
           $ref: '#/components/schemas/SchemaType'
+          description: upon updating a schema, the type of an existing schema can't be changed
       required:
         - subject
         - schema
@@ -2624,6 +2626,7 @@ components:
 
     SchemaType:
       type: string
+      description: upon updating a schema, the type of an existing schema can't be changed
       enum:
         - AVRO
         - JSON
diff --git a/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx b/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx
index 01ab9802faf..a09f45a568c 100644
--- a/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx
+++ b/kafka-ui-react-app/src/components/Schemas/Edit/Edit.tsx
@@ -124,7 +124,7 @@ const Edit: React.FC = () => {
                     value={schema.schemaType}
                     onChange={onChange}
                     minWidth="100%"
-                    disabled={isSubmitting}
+                    disabled
                     options={Object.keys(SchemaType).map((type) => ({
                       value: type,
                       label: type,


Test patch: