karapace
karapace copied to clipboard
VersionNotFound on compatibility check
If the subject does not exits we used to get SubjectNotFound, but with the newest update we get VersionNotFound
for compatibility/subjects/my-subject/versions/latest
, is that intended?
I am assuming it is due to this change: https://github.com/aiven/karapace/pull/450
This newly maps the SchemasNotFoundException
to the same error code as VersionNotFoundException
which is VERSION_NOT_FOUND
. I think for SchemasNotFoundException
we still should get SUBJECT_NOT_FOUND
as error code, what do you think @jjaakola-aiven ?
@nick-zh Thank you for the report. Just a fast thought on this. If the subject does not exist, nor there is any version, the API should return that given schema is compatible. As there is no previous schema to be incompatible with.
@jjaakola-aiven it depends on what the user wants to know after the request, so the way we handle it is that we catch that exception and set our check to true, others might want to do different things. I would advocate that the more information the better so i can differentiate all the cases:
- is really compatible (the schema i try to compare for compatibility exists and is compatible or not)
- version does not exist
- subject does not exist
It looks that Confluent's Schema Registry returns that given schema is compatible. If one needs to know if a subject or a version in a subject exists, there are other API endpoints for those needs.
Indeed, so then i think instead of the current VersionNotFoundException
Karapace should also return the same as confluent schema registry if the subject does not exist to be consistent (as suggested by @jjaakola-aiven ), what do you think @tvainika ?
Indeed, so then i think instead of the current
VersionNotFoundException
Karapace should also return the same as confluent schema registry if the subject does not exist to be consistent
Yes, that's the way to do it. Let's see when we can fix this, but should be easy one if anyone wants to take a look. Patches welcome.