confluent-kafka-python
confluent-kafka-python copied to clipboard
Add schemaregistryclient methods 1429
Add missing methods to SchemaRegistryClient for REST API :
- [x]
get_schema_types() -> list(str) - [x]
get_schema_versions(schema_id: int) -> list(dict) - [ ]
get_schema_by_subject_version(subject_name:str, version:int) -> Schema- needs discussion - [x]
get_referencedby(subject_name:str, version:int) -> list(int)
Updated
- [x] Unit tests
- [x] Integration tests
- [x] Documentation
Closes #1429
Hi @mhowlett :-)
I would like some feedback on the get_schema_by_subject_version method, see commit c1c41ba
The method name was the best I could come up with within the existing namespace. Let me know if this is ok.
The return type Schema(), which I initially selected to mimic the existing get_schema()-> Schema method, may not be optimal:
- The REST API simply returns the "unencoded schema string", so the method may add to much complexity.
- We don't know the schema type from the single REST call (I hardcoded AVRO), so we need an additional roundtrip to fetch the actual type.
Also note, the requests lib converts the unescaped json str (for type=AVRO/JSON) to a python dict, which must be cast back to a str. This results in a format change (newline/whitespace). Can/should we avoid this str->json->dict->str round-trip?
I think we should go with str (unescaped) return type instead, but want your feedback first.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
@mhowlett