GithubHelp home page GithubHelp logo

Comments (10)

nrwiersma avatar nrwiersma commented on May 19, 2024 1

The fix can be found in v1.2.0, with thanks to @mcgrawia for providing it.

from avro.

nrwiersma avatar nrwiersma commented on May 19, 2024

The subject latest endpoint does not return the schema id, just the version and the schema as seen here:

https://docs.confluent.io/current/schema-registry/develop/api.html

{
  "name": "test",
  "version": 1,
  "schema": "{\"type\": \"string\"}"
}

from avro.

mcgrawia avatar mcgrawia commented on May 19, 2024

Hi @nrwiersma I was trying to figure this out as well. Looking at the doc you linked above, it looks like the GET /subjects/(string: subject)/versions/(versionId: version) endpoint does return the schema ID: https://docs.confluent.io/current/schema-registry/develop/api.html#get--subjects-(string-%20subject)-versions-(versionId-%20version)

It isn't in the example response but it is in the response description. I was also able to confirm running the registry locally with the confluentinc/cp-schema-registry:latest docker image.

Response JSON Object:
--
subject (string) – Name of the subject that this schema is registered under
id (int) – Globally unique identifier of the schema
version (int) – Version of the returned schema
schema (string) – The schema string

Sample response:

{
    "subject": "test",
    "version": 1,
    "id": 2,
    "schema": "..."
}

thanks!

from avro.

nrwiersma avatar nrwiersma commented on May 19, 2024

No, there is a mismatch between the reported returns and the example. Interestingly I checked https://github.com/salsify/avro-schema-registry which I have for a long time used as my registry, and it does not return the id in this command. I assume it was added since the client was added.

I will gladly add an additional function to get it, to not break backward compatibility, but it should be noted for the kafka case, this should not be needed. We instead used fingerprint checking that is provided by https://github.com/salsify/avro-schema-registry which tells you if a schema is registered and what its id is. This allows the publication of multiple versions of the schema at the same time by multiple versions of your application.

from avro.

mcgrawia avatar mcgrawia commented on May 19, 2024

That would be fantastic, thank you. Let me know if a PR would be helpful. I'm relatively new to go but happy to try my hand at one.

One of the reason my use cases needs this ability is because our producing application consumes unique messages from customers. The application looks up the latest schema for a customer by subject, then writes the data to kafka. I don't think we would be able to use the pattern you described because our application does not have the schema in the source code?

from avro.

nrwiersma avatar nrwiersma commented on May 19, 2024

Fair enough.

If you would like to try your hand at it, that would be great, I am always glad to get PRs. We cannot add it to the current function at this time, as it would be backward breaking. I would suggest you add function GetLatestSchemaId with its own payload. You can follow the tests for GetLatestSchema as coveralls will not let it pass without them.

Have fun 😄

from avro.

mcgrawia avatar mcgrawia commented on May 19, 2024

@nrwiersma sounds good. I have a PR ready but I'm getting a "access denied" error when trying to push my new branch to the repo. Could you give me write access or is there another way to create a PR?

Thanks

from avro.

nrwiersma avatar nrwiersma commented on May 19, 2024

Hi. You need to make a fork of it and then make your branch. You can then create the PR against master on the main repo.

from avro.

mcgrawia avatar mcgrawia commented on May 19, 2024

thanks that did the trick

from avro.

nrwiersma avatar nrwiersma commented on May 19, 2024

Fixed by #56

from avro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.