{"id":22220981,"url":"https://github.com/nokia/avro-schema-generator","last_synced_at":"2025-07-27T16:30:55.045Z","repository":{"id":6654350,"uuid":"7898787","full_name":"nokia/Avro-Schema-Generator","owner":"nokia","description":"Tool which generates Avro schemas and Java bindings from XML schemas.","archived":false,"fork":false,"pushed_at":"2020-08-03T15:09:33.000Z","size":28,"stargazers_count":37,"open_issues_count":7,"forks_count":26,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-04-14T13:07:11.023Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nokia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-29T18:56:11.000Z","updated_at":"2023-06-27T17:35:41.000Z","dependencies_parsed_at":"2022-07-09T09:16:26.471Z","dependency_job_id":null,"html_url":"https://github.com/nokia/Avro-Schema-Generator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2FAvro-Schema-Generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2FAvro-Schema-Generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2FAvro-Schema-Generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nokia%2FAvro-Schema-Generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nokia","download_url":"https://codeload.github.com/nokia/Avro-Schema-Generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227817165,"owners_count":17824199,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-02T23:11:19.935Z","updated_at":"2024-12-02T23:11:20.583Z","avatar_url":"https://github.com/nokia.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is it?\r\nThe schema generator works alongside the JAXB binding compiler to produce Avro bindings which are\r\nvery similar to the JAXB classes. The process is wrapped in a Maven plugin, which allows for manual\r\nor automatic execution of the process. The plugin completes in one step the generation of JAXB classes,\r\nAvro schemas, and Avro classes.\r\n\r\nFor more information about the projet, read the writeup on InfoQ:  \r\nhttp://www.infoq.com/articles/AVROSchemaJAXB\r\n\r\n# How does it work?\r\nThe first part of the process utilizes XJC, the JAXB Binding Compiler, to produce a Java code model from a\r\nseries of xsd schema files. After this is finished, an XJC plugin runs which inspects the classes to\r\nbe generated and produces parallel Avro schemas in JSON format. Then the classes and schemas are written out.\r\nFinally, the plugin calls the Java schema compiler provided by the Avro project to produce a new set of Java\r\nclasses for serialization to and from Avro.\r\n\r\n# Where to get it?\r\nCurrently the plugin is not available from maven central, so you will have to download the source and install\r\nit to your local Maven repository.\r\n\r\n# How to run it.\r\nThe schema generator is wrapped into a Maven plugin, which can be executed manually or as part of a build process. The\r\nschemagen-plugin component provides a plugin with one goal, \"generate\". There is no default phase to which the goal is\r\nbound, so it will never be executed automatically without first specifying the phase when it should run. For example,\r\nthe 'validate' or 'generate-sources' phase is a good place to put such activities, as they run prior to the compile phase.\r\n\r\nYour Maven project would include a plugin declaration similar to this:\r\n\r\n    \u003cplugin\u003e\r\n        \u003cgroupId\u003ecom.nokia.util.avro\u003c/groupId\u003e\r\n        \u003cartifactId\u003eschemagen-plugin\u003c/artifactId\u003e\r\n        \u003cversion\u003e0.3\u003c/version\u003e\r\n        \u003cconfiguration\u003e\r\n            \u003coutputDirectory\u003e..\\sources\u003c/outputDirectory\u003e\r\n            \u003cpackageName\u003emy.generated\u003c/packageName\u003e\r\n            \u003cbindingFiles\u003e\r\n                \u003cfile\u003eresources/binding1.xsd\u003c/file\u003e\r\n            \u003c/bindingFiles\u003e\r\n            \u003cschemaFiles\u003e\r\n                \u003cschema\u003eresources/schema1.xsd\u003c/schema\u003e\r\n            \u003c/schemaFiles\u003e\r\n        \u003c/configuration\u003e\r\n    \u003c/plugin\u003e\r\n\t\r\nCurrently you must provide all schema files you wish to be considered in the bindings and schemas lists.\r\nThe plugin's exposed name is \"schemagen\". So now from the command line you can navigate to your POM file and\r\nexecute the following command:\r\n\r\n    mvn schemagen:generate\r\n\r\nThis will invoke the entire workflow on your input data. The artifacts produced by the process are:\r\n* JAXB generated Java sources\r\n* Avro schema files (JSON)\r\n* Avro generated Java sources\r\n\r\nYou can then use the Java files needed. To have the source files compiled automatically, you will want to\r\neither have them created in folder which is part of your Maven project's source directory, or explicitly\r\nadd an include for the generated directory using the maven-compiler plugin.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnokia%2Favro-schema-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnokia%2Favro-schema-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnokia%2Favro-schema-generator/lists"}