{"id":22269096,"url":"https://github.com/diogofcunha/avro-schema-builder","last_synced_at":"2026-05-04T01:33:50.343Z","repository":{"id":172870326,"uuid":"552273566","full_name":"diogofcunha/avro-schema-builder","owner":"diogofcunha","description":"A robust and feature-rich package for building Avro Schema definitions.","archived":false,"fork":false,"pushed_at":"2023-06-05T22:33:27.000Z","size":127,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-02T01:39:04.041Z","etag":null,"topics":["avro","avro-kafka","avro-schema","avro-schema-registry","javascript","kafka-js","nodejs","schema","schema-builder","serialization","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/diogofcunha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-16T07:51:42.000Z","updated_at":"2023-06-05T22:19:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"f382f090-5497-4b85-8641-e4d932d5b56a","html_url":"https://github.com/diogofcunha/avro-schema-builder","commit_stats":null,"previous_names":["diogofcunha/avro-schema-builder"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/diogofcunha/avro-schema-builder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diogofcunha%2Favro-schema-builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diogofcunha%2Favro-schema-builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diogofcunha%2Favro-schema-builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diogofcunha%2Favro-schema-builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diogofcunha","download_url":"https://codeload.github.com/diogofcunha/avro-schema-builder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diogofcunha%2Favro-schema-builder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32591601,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T22:12:39.696Z","status":"ssl_error","status_checked_at":"2026-05-03T22:09:10.534Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["avro","avro-kafka","avro-schema","avro-schema-registry","javascript","kafka-js","nodejs","schema","schema-builder","serialization","typescript"],"created_at":"2024-12-03T11:15:06.857Z","updated_at":"2026-05-04T01:33:50.338Z","avatar_url":"https://github.com/diogofcunha.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# avro-schema-builder\n\n[![CircleCI](https://circleci.com/gh/diogofcunha/avro-schema-builder.svg?style=svg)](https://circleci.com/gh/diogofcunha/avro-schema-builder)\n[![npm package][npm-badge]][npm]\n\n[npm-badge]: https://img.shields.io/npm/v/avro-schema-builder.png?style=flat-square\n[npm]: https://www.npmjs.com/package/avro-schema-builder\n\nA robust and feature-rich package for building Avro Schema definitions.\n\n## Description\n\navro-schema-builder is a convenient way of programmatically building Avro Schemas. With the help of TypeScript type definitions, this library provides a type-safe and self-documenting way of creating Avro schemas, without dealing with JSON files or worrying about schema validation or learning the depth of Avro specific representation like defaults and object nesting.\n\n## Install\n\n```bash\nyarn add avro-schema-builder\n```\n\n```bash\nnpm install avro-schema-builder\n```\n\n## Usage\n\n```typescript\nimport {AvroSchemaBuilder, PrimitiveField, PrimitiveType} from 'avro-schema-builder';\n\nnew AvroSchemaBuilder('myRecord')\n  .record('record.record')\n  .addField(\n    new RecordField({\n      namespace: 'record.primitive.x',\n      name: 'children',\n      doc: 'children field',\n      order: FieldOrder.ascending,\n      nullable: true,\n    })\n      .addField(\n        new PrimitiveField({\n          name: 'id',\n          type: 'int',\n        }),\n      )\n      .addField(\n        new RecordField({\n          namespace: 'record.primitive.x.y',\n          name: 'grandchildren',\n          doc: 'children field',\n          order: FieldOrder.descending,\n          nullable: true,\n          defaultValue: null,\n        }).addField(\n          new PrimitiveField({\n            name: 'id',\n            type: 'int',\n          }),\n        ),\n      ),\n  )\n  .compile();\n\nconsole.log(JSON.stringify(schema, null, 2));\n```\n\nThis will output the following Avro Schema:\n\n```json\n{\n  \"type\": \"record\",\n  \"name\": \"myRecord\",\n  \"namespace\": \"record.record\",\n  \"fields\": [\n    {\n      \"name\": \"children\",\n      \"type\": [\n        \"null\",\n        {\n          \"fields\": [\n            {\n              \"name\": \"id\",\n              \"type\": \"int\"\n            },\n            {\n              \"name\": \"grandchildren\",\n              \"type\": [\n                \"null\",\n                {\n                  \"default\": null,\n                  \"fields\": [\n                    {\n                      \"name\": \"id\",\n                      \"type\": \"int\"\n                    }\n                  ],\n                  \"name\": \"grandchildren\",\n                  \"namespace\": \"record.primitive.x.y\",\n                  \"type\": \"record\"\n                }\n              ]\n            }\n          ],\n          \"name\": \"children\",\n          \"namespace\": \"record.primitive.x\",\n          \"type\": \"record\"\n        }\n      ]\n    }\n  ]\n}\n```\n\n## Documentation\n\nThis package provides several classes and types for building Avro schemas:\n\n- `AvroSchemaBuilder`: Main entry point for creating a schema. It is initialized with the name of the schema.\n- `FieldBuilder`: Represents a field in the schema. It can be of various types including PrimitiveField, RecordField, ArrayField, EnumField, MapField, FixedField, UnionField, and ReferenceField.\n- Other classes (`PrimitiveField`, `RecordField`, `ArrayField`, etc.): Represent the different types of fields available in Avro.\n- `types`: Contains TypeScript type definitions for the various Avro types.\n\nFor a more detailed explanation of the classes and types available, and how to use them, please check out the source code and the test cases.\n\n## Contributing\n\nContributions are welcome! Please submit a pull request with any improvements or bug fixes. Make sure to add tests for any new features and bug fixes, and ensure that the existing tests pass.\n\n# License\n\nThis project is licensed under the MIT License.\n\n# Contact\n\nIf you need help or have questions, feel free to open an issue in the GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiogofcunha%2Favro-schema-builder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiogofcunha%2Favro-schema-builder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiogofcunha%2Favro-schema-builder/lists"}