Giter Club home page Giter Club logo

avroschema-wizard-plugin's Introduction

Avroschema-wizard-plugin (Gradle) ๐Ÿ˜

License Language Download

Plugin to interact with schema-registry using API Schema registry.

Simplify schema registration under specific subjects (topic names) and conduct seamless compatibility checks. This plugin streamlines the integration of Avro schemas, enhancing your local testing process and ensuring smooth execution in integration tests and CI pipelines. Use it now to effortlessly manage enrollment and schema validation in your Kafka ecosystem!

License ๐Ÿ“„

This plugin is licensed under the MIT License - see the License file for details.

Use cases

The plugin simplifies kafka consumer testing when using avro schemas, and also provides additional features such as compatibility check. It can be used in local testing, as well as in integration tests or CI.

Features:

  • registration of schemes under subjects
  • compatibility check

How to use ๐Ÿ‘ฃ

build.gradle.kts:

plugins {
    id("io.github.rudikone.avroschema-wizard-plugin") version <version>
}

avroWizardConfig {
    schemaRegistryUrl = "some_url"
    searchAvroFilesPaths = setOf("../some/search/path/1", "../some/search/path/2")
    topicToSchema = mapOf("some-topic-1" to "SomeSchemaName1", "some-topic-2" to "SomeSchemaName2")
    subjectNameStrategy = "TopicNameStrategy"
}

Register schemas:

run

gradle registerAllSchemas

The task will search for files with extension .avsc, whose names (without extension) are passed as topicToSchema map values, in the directories passed to searchAvroFilesPaths, and register schemas by appropriate subjects depending on the subjectNameStrategy value.

Output: Registered <schema_name> with id: <id_from_registry> for <topic_name>

If a schema with the same name is registered under multiple subjects, the id will be assigned to it once. See Documentation

Compatibility check:

run

gradle checkCompatibility

The task will search for files with extension .avsc, whose names (without extension) are passed as topicToSchema map values, in the directories passed to searchAvroFilesPaths, and check the compatibility of the new versions of the schemas by appropriate subjects depending on the subjectNameStrategy value.

OR

run

gradle checkCompatibility --subject=<subject-name> --schema=<schema-name>

The task will search for a file with the extension .avsc, whose name (without extension) is passed as a command line argument (schema), in the directories given in searchAvroFilesPaths, and check if the passed schema is compatible with the schema under the subject passed as a command line argument (subject).

If the subject does not exist, an error will be thrown!

Output: Schema <schema_name> is (not) compatible with the latest schema under subject <subject_name>

Properties:

Name Description Default value
schemaRegistryUrl Schema registry URL "http://localhost:10081"
searchAvroFilesPaths List of directories to search for files with extension .avcs build directory of the project
subjectToSchema Subject (topic) to schema name map -
subjectNameStrategy Subject Name Strategy: TopicNameStrategy, RecordNameStrategy, TopicRecordNameStrategy TopicNameStrategy

Example:

See example module. Run docker-compose, testing plugin tasks. For convenience, you can use schema-registry-ui (http://localhost:8002/ in your browser).

Contributing ๐Ÿค

Feel free to open an issue or submit a pull request for any bugs/improvements.

avroschema-wizard-plugin's People

Contributors

rudikone avatar

Stargazers

 avatar

Watchers

 avatar

avroschema-wizard-plugin's Issues

Java object from Avro file

I am quite new to Avro. I tried registerAllSchemas and checkCompatibility both seems to be working fine i.e. I can see the present of schema registrations with these rest calls to the schema registry:
/subjects
/subjects/<subject>/versions
/subjects/<subject>/versions/<version>

I was also expecting the plugin would generate Java class from the Avro file but it didn't. Is it an correct assumption?

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.