Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccompat api missing field in answer #4569

Closed
Shawcs opened this issue Apr 18, 2024 · 1 comment · Fixed by #4570
Closed

ccompat api missing field in answer #4569

Shawcs opened this issue Apr 18, 2024 · 1 comment · Fixed by #4570
Assignees
Labels
area/storage Bug Something isn't working

Comments

@Shawcs
Copy link

Shawcs commented Apr 18, 2024

Description

Registry Version:2.5.10
Persistence type: kafkasql

I found a regression in the response of one of the rest endpoint of the ccompat/v6 and ccompat/v7

when requesting: /apis/ccompat/v6/subjects/{subject}/versions/latest or /apis/ccompat/v7/subjects/{subject}/versions/latest
if the schema is not AVRO the response doesn't return the schemaType

Steps to Reproduce

Launch a 2.5.5 Registry image (it's the one I tried but I didn't checked with other version)

  • register a json schema like:
curl --request POST \
  --url 'https://broker-schema-registry.com/apis/registry/v2/groups/default/artifacts?ifExists=RETURN&cononical=true' \
  --header 'X-Registry-ArtifactId: bank-json-value' \
  --header 'X-Registry-ArtifactType: JSON' \
  --header 'X-Registry-Name: com.json' \
  --data '{
  "id" : "urn:jsonschema:com:OperationRef",
  "title" : "OperationRef",
  "$defs" : {
    "OperationRef" : {
      "type" : "object",
      "id" : "urn:jsonschema:com:OperationRef",
      "properties" : {
        "reference" : {
          "type" : "string"
        },
        "type" : {
          "type" : "string"
        }
      }
    },
    "TransactionRef" : {
      "type" : "object",
      "id" : "urn:jsonschema:com:TransactionRef",
      "properties" : {
        "type" : {
          "type" : "string"
        },
        "value" : {
          "type" : "string"
        }
      }
    }
  }
}'
  • recover the latest subject for this artifact with the ccompat api with:
curl --request GET \
  --url https://broker-schema-registry.com/apis/ccompat/v6/subjects/bank-json-value/versions/latest
#OR
curl --request GET \
  --url https://broker-schema-registry..com/apis/ccompat/v7/subjects/bank-json-value/versions/latest
  • response:
{
	"id": 3,
	"subject": "bank-json-value",
	"version": 1,
	"schema": "{\n  \"id\" : \"urn:jsonschema:com:OperationRef\",\n  \"title\" : \"OperationRef\",\n  \"$defs\" : {\n    \"OperationRef\" : {\n      \"type\" : \"object\",\n      \"id\" : \"urn:jsonschema:com:OperationRef\",\n      \"properties\" : {\n        \"reference\" : {\n          \"type\" : \"string\"\n        },\n        \"type\" : {\n          \"type\" : \"string\"\n        }\n      }\n    },\n    \"TransactionRef\" : {\n      \"type\" : \"object\",\n      \"id\" : \"urn:jsonschema:com:TransactionRef\",\n      \"properties\" : {\n        \"type\" : {\n          \"type\" : \"string\"\n        },\n        \"value\" : {\n          \"type\" : \"string\"\n        }\n      }\n    }\n  }\n}",
	"schemaType": "JSON",
	"references": []
}

Launch a 2.5.10 Registry Image, clear the kafkasql-journal topic

  • register a schema in the same way as before

  • get the schema metadata the same way:

curl --request GET \
  --url https://broker-schema-registry.com/apis/ccompat/v6/subjects/bank-json-value/versions/latest
#OR
curl --request GET \
  --url https://broker-schema-registry..com/apis/ccompat/v7/subjects/bank-json-value/versions/latest
  • response:
{
	"id": 22,
	"subject": "bank-json-value",
	"version": 1,
	"schema": "{\n  \"id\" : \"urn:jsonschema:com:OperationRef\",\n  \"title\" : \"OperationRef\",\n  \"$defs\" : {\n    \"OperationRef\" : {\n      \"type\" : \"object\",\n      \"id\" : \"urn:jsonschema:com:OperationRef\",\n      \"properties\" : {\n        \"reference\" : {\n          \"type\" : \"string\"\n        },\n        \"type\" : {\n          \"type\" : \"string\"\n        }\n      }\n    },\n    \"TransactionRef\" : {\n      \"type\" : \"object\",\n      \"id\" : \"urn:jsonschema:com:TransactionRef\",\n      \"properties\" : {\n        \"type\" : {\n          \"type\" : \"string\"\n        },\n        \"value\" : {\n          \"type\" : \"string\"\n        }\n      }\n    }\n  }\n}",
	"references": []
}

Expected vs Actual Behaviour

The API should give the schemaType like in the 2.5.5 version and as stated in the confluent API (as we are in the ccompat api) here: https://docs.confluent.io/platform/current/schema-registry/develop/api.html#get--subjects-(string-%20subject)-versions-(versionId-%20version)

Also the swagger of the ccompat api should be updated (actually for both version 2.5.5 and 2.5.10) because the schema type is never referenced in the 200 response code documentation

@Shawcs Shawcs added the Bug Something isn't working label Apr 18, 2024
@carlesarnal
Copy link
Member

Hello @Shawcs thanks for the report. I have confirmed this. Apparently, during the refactor, I missed a parameter in a function (and a test, of course). I'll create a PR fixing it.

Thanks!

@carlesarnal carlesarnal self-assigned this Apr 18, 2024
@carlesarnal carlesarnal linked a pull request Apr 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/storage Bug Something isn't working
Projects
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants