Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
587 stars 260 forks source link

Include ArtifactType header in REST response to /ids/* requests #5209

Open wolfchimneyrock opened 1 day ago

wolfchimneyrock commented 1 day ago

I'm trying to replicate the confluent-kafka-python schema_registry_client behavior. in its get_schema(schema_id) method, the returned object includes both the schema contents string and its type.

Currently, using these api calls /ids/contentIds/{id}, /ids/globalIds/{id} and /ids/contentHashes/{hash} we get the artifact version contents string, but no indication of the artifact type.

can you add a response header with the artifact's type? this change wouldn't impact other clients, but would help to achieve feature parity with the confluent python client.

apicurio-bot[bot] commented 1 day ago

Thank you for reporting an issue!

Pinging @andreaTP to respond or triage.

EricWittmann commented 16 hours ago

This could be done fairly easily for the globalId but not easily for the other two. The reason is that globalId is a pointer to a specific artifact version. So it's easy to get the artifactType in this case, because we know the artifact. But for contentId and contentHash, the lookup is artifact agnostic, and is a many-to-one relationship. It's possible that the content is used by multiple versions across multiple artifacts. And it's possible that those artifacts have different types (though admittedly the normal case is that they would have the same type).

@carlesarnal @jsenko wdyt?