Fetch already published schemas by Subject and Version (or latest)
Sometimes there is a need to download an already published schema by Subject and Version. I didn't add the schemas to the local cache as, as far as I understand, in this use case the user of the library should be the one taking care of how to use the schema.
Hello,
Thanks for the PR, looks like this feature is missing. But perhaps it should be implemented as part of
maybe_download/1function.
Hello, thanks for reviewing!
As far as I understand maybe_download/1 retrieves a decoded schema by either SchemaId or SubjectName and Fingerprint.
In my use case, as I didn't register the schema, I don't know the schemaId or the Fingerprint. I do believe that this use case is out of the main flow supported by this library so it should be an independent function, as it's just an extra. What do you think?
Why not cache it, if the caller of this new API can benefit from having it cached. e.g. so it can crash then restart without having to re-download.
The cache key is currently either
regid()or{Subject, FP}. We can expand the cache key to support{Subject, Version}however, the current patterns are-define(IS_REGID(Id), is_integer(Id)). -define(IS_NAME_FP(NF), (is_tuple(Ref) andalso size(Ref) =:= 2)). -define(IS_REF(Ref), (?IS_REGID(Ref) orelse ?IS_NAME_FP(Ref))).I guess we'll have to add a tuple of size 3 for this new cache.
If you guys believe this flow should be part of the app then yes, let's make the proposed changes. I'll take care of it.
Sorry for late reply. zmstone is right about caching. Other interfaces of this library imply that caching is present, so it's good to keep everything consistent.
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.
Pablo López Viqueira seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.