avrotize 2.22.1__tar.gz → 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. {avrotize-2.22.1 → avrotize-3.0.0}/PKG-INFO +63 -14
  2. {avrotize-2.22.1 → avrotize-3.0.0}/README.md +62 -13
  3. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/_version.py +3 -3
  4. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/class_test.cs.jinja +33 -2
  5. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/dataclass_core.jinja +26 -5
  6. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/project.csproj.jinja +3 -0
  7. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp.py +19 -1
  8. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsv.py +16 -0
  9. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/commands.json +213 -4
  10. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/constants.py +5 -0
  11. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/cs/net90/dependencies.csproj +1 -0
  12. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/dataclass_core.jinja +110 -3
  13. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/project.csproj.jinja +3 -0
  14. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp.py +108 -28
  15. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots.py +2 -2
  16. {avrotize-2.22.1 → avrotize-3.0.0}/LICENSE +0 -0
  17. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/__init__.py +0 -0
  18. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/__main__.py +0 -0
  19. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/asn1toavro.py +0 -0
  20. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotize.py +0 -0
  21. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocpp/CMakeLists.txt.jinja +0 -0
  22. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocpp/build.bat.jinja +0 -0
  23. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocpp/build.sh.jinja +0 -0
  24. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocpp/dataclass_body.jinja +0 -0
  25. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocpp/vcpkg.json.jinja +0 -0
  26. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocpp.py +0 -0
  27. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/README.md.jinja +0 -0
  28. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/enum_test.cs.jinja +0 -0
  29. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/project.sln.jinja +0 -0
  30. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/run_coverage.ps1.jinja +0 -0
  31. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/run_coverage.sh.jinja +0 -0
  32. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotocsharp/testproject.csproj.jinja +0 -0
  33. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotodatapackage.py +0 -0
  34. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotodb.py +0 -0
  35. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotogo/go_enum.jinja +0 -0
  36. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotogo/go_helpers.jinja +0 -0
  37. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotogo/go_struct.jinja +0 -0
  38. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotogo/go_test.jinja +0 -0
  39. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotogo/go_union.jinja +0 -0
  40. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotogo.py +0 -0
  41. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotographql.py +0 -0
  42. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotoiceberg.py +0 -0
  43. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojava/class_test.java.jinja +0 -0
  44. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojava/enum_test.java.jinja +0 -0
  45. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojava/testproject.pom.jinja +0 -0
  46. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojava.py +0 -0
  47. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojs.py +0 -0
  48. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojsons.py +0 -0
  49. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotojstruct.py +0 -0
  50. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotokusto.py +0 -0
  51. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotomd/README.md.jinja +0 -0
  52. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotomd.py +0 -0
  53. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotools.py +0 -0
  54. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotoparquet.py +0 -0
  55. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotoproto.py +0 -0
  56. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotopython/dataclass_core.jinja +0 -0
  57. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotopython/enum_core.jinja +0 -0
  58. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotopython/pyproject_toml.jinja +0 -0
  59. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotopython/test_class.jinja +0 -0
  60. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotopython/test_enum.jinja +0 -0
  61. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotopython.py +0 -0
  62. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotorust/dataclass_enum.rs.jinja +0 -0
  63. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotorust/dataclass_struct.rs.jinja +0 -0
  64. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotorust/dataclass_union.rs.jinja +0 -0
  65. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotorust.py +0 -0
  66. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/class_core.ts.jinja +0 -0
  67. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/class_test.ts.jinja +0 -0
  68. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/enum_core.ts.jinja +0 -0
  69. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/gitignore.jinja +0 -0
  70. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/index.ts.jinja +0 -0
  71. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/package.json.jinja +0 -0
  72. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots/tsconfig.json.jinja +0 -0
  73. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotots.py +0 -0
  74. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/avrotoxsd.py +0 -0
  75. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/cddltostructure.py +0 -0
  76. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/common.py +0 -0
  77. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/csvtoavro.py +0 -0
  78. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/datapackagetoavro.py +0 -0
  79. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
  80. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/go/go121/go.mod +0 -0
  81. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/java/jdk21/pom.xml +0 -0
  82. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/python/py312/requirements.txt +0 -0
  83. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/rust/stable/Cargo.toml +0 -0
  84. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependencies/typescript/node22/package.json +0 -0
  85. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependency_resolver.py +0 -0
  86. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/dependency_version.py +0 -0
  87. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/generic/generic.avsc +0 -0
  88. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/jsonstoavro.py +0 -0
  89. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/jsonstostructure.py +0 -0
  90. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/jstructtoavro.py +0 -0
  91. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/kstructtoavro.py +0 -0
  92. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/kustotoavro.py +0 -0
  93. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/openapitostructure.py +0 -0
  94. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/parquettoavro.py +0 -0
  95. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/proto2parser.py +0 -0
  96. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/proto3parser.py +0 -0
  97. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototoavro.py +0 -0
  98. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/any.avsc +0 -0
  99. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/api.avsc +0 -0
  100. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/duration.avsc +0 -0
  101. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/field_mask.avsc +0 -0
  102. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/struct.avsc +0 -0
  103. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/timestamp.avsc +0 -0
  104. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/type.avsc +0 -0
  105. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/prototypes/wrappers.avsc +0 -0
  106. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocddl.py +0 -0
  107. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocpp/CMakeLists.txt.jinja +0 -0
  108. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocpp/build.bat.jinja +0 -0
  109. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocpp/build.sh.jinja +0 -0
  110. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocpp/dataclass_body.jinja +0 -0
  111. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocpp/vcpkg.json.jinja +0 -0
  112. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocpp.py +0 -0
  113. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/class_test.cs.jinja +0 -0
  114. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/enum_test.cs.jinja +0 -0
  115. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/json_structure_converters.cs.jinja +0 -0
  116. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/program.cs.jinja +0 -0
  117. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/project.sln.jinja +0 -0
  118. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/testproject.csproj.jinja +0 -0
  119. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsharp/tuple_converter.cs.jinja +0 -0
  120. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretocsv.py +0 -0
  121. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretodatapackage.py +0 -0
  122. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretodb.py +0 -0
  123. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretogo/go_enum.jinja +0 -0
  124. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretogo/go_helpers.jinja +0 -0
  125. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretogo/go_interface.jinja +0 -0
  126. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretogo/go_struct.jinja +0 -0
  127. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretogo/go_test.jinja +0 -0
  128. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretogo.py +0 -0
  129. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretographql.py +0 -0
  130. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretoiceberg.py +0 -0
  131. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava/choice_core.jinja +0 -0
  132. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava/class_core.jinja +0 -0
  133. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava/enum_core.jinja +0 -0
  134. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava/equals_hashcode.jinja +0 -0
  135. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava/pom.xml.jinja +0 -0
  136. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava/tuple_core.jinja +0 -0
  137. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojava.py +0 -0
  138. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs/class_core.js.jinja +0 -0
  139. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs/enum_core.js.jinja +0 -0
  140. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs/package.json.jinja +0 -0
  141. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs/test_class.js.jinja +0 -0
  142. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs/test_enum.js.jinja +0 -0
  143. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs/test_runner.js.jinja +0 -0
  144. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojs.py +0 -0
  145. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretojsons.py +0 -0
  146. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretokusto.py +0 -0
  147. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretomd/README.md.jinja +0 -0
  148. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretomd.py +0 -0
  149. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretoproto.py +0 -0
  150. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython/dataclass_core.jinja +0 -0
  151. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython/enum_core.jinja +0 -0
  152. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython/map_alias.jinja +0 -0
  153. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython/pyproject_toml.jinja +0 -0
  154. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython/test_class.jinja +0 -0
  155. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython/test_enum.jinja +0 -0
  156. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretopython.py +0 -0
  157. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretorust/dataclass_enum.rs.jinja +0 -0
  158. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretorust/dataclass_struct.rs.jinja +0 -0
  159. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretorust/dataclass_union.rs.jinja +0 -0
  160. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretorust.py +0 -0
  161. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/class_core.ts.jinja +0 -0
  162. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/enum_core.ts.jinja +0 -0
  163. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/gitignore.jinja +0 -0
  164. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/index.ts.jinja +0 -0
  165. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/package.json.jinja +0 -0
  166. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/test_class.ts.jinja +0 -0
  167. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretots/tsconfig.json.jinja +0 -0
  168. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/structuretoxsd.py +0 -0
  169. {avrotize-2.22.1 → avrotize-3.0.0}/avrotize/xsdtoavro.py +0 -0
  170. {avrotize-2.22.1 → avrotize-3.0.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: avrotize
3
- Version: 2.22.1
3
+ Version: 3.0.0
4
4
  Summary: Tools to convert from and to Avro Schema from various other schema languages.
5
5
  Author-email: Clemens Vasters <clemensv@microsoft.com>
6
6
  Requires-Python: >=3.10
@@ -90,13 +90,13 @@ Converting from Avrotize Schema:
90
90
  - [`avrotize a2k`](#convert-avrotize-schema-to-kusto-table-declaration) - Convert Avrotize Schema to Kusto table definition.
91
91
  - [`avrotize s2k`](#convert-json-structure-schema-to-kusto-table-declaration) - Convert JSON Structure Schema to Kusto table definition.
92
92
  - [`avrotize a2sql`](#convert-avrotize-schema-to-sql-table-definition) - Convert Avrotize Schema to SQL table definition.
93
- - [`avrotize struct2sql`](#convert-json-structure-schema-to-sql-schema) - Convert JSON Structure Schema to SQL table definition.
93
+ - [`avrotize s2sql`](#convert-json-structure-schema-to-sql-schema) - Convert JSON Structure Schema to SQL table definition.
94
94
  - [`avrotize a2pq`](#convert-avrotize-schema-to-empty-parquet-file) - Convert Avrotize Schema to Parquet or Iceberg schema.
95
95
  - [`avrotize a2ib`](#convert-avrotize-schema-to-iceberg-schema) - Convert Avrotize Schema to Iceberg schema.
96
96
  - [`avrotize s2ib`](#convert-json-structure-to-iceberg-schema) - Convert JSON Structure to Iceberg schema.
97
97
  - [`avrotize a2mongo`](#convert-avrotize-schema-to-mongodb-schema) - Convert Avrotize Schema to MongoDB schema.
98
98
  - [`avrotize a2cassandra`](#convert-avrotize-schema-to-cassandra-schema) - Convert Avrotize Schema to Cassandra schema.
99
- - [`avrotize struct2cassandra`](#convert-json-structure-schema-to-cassandra-schema) - Convert JSON Structure Schema to Cassandra schema.
99
+ - [`avrotize s2cassandra`](#convert-json-structure-schema-to-cassandra-schema) - Convert JSON Structure Schema to Cassandra schema.
100
100
  - [`avrotize a2es`](#convert-avrotize-schema-to-elasticsearch-schema) - Convert Avrotize Schema to Elasticsearch schema.
101
101
  - [`avrotize a2dynamodb`](#convert-avrotize-schema-to-dynamodb-schema) - Convert Avrotize Schema to DynamoDB schema.
102
102
  - [`avrotize a2cosmos`](#convert-avrotize-schema-to-cosmosdb-schema) - Convert Avrotize Schema to CosmosDB schema.
@@ -106,7 +106,7 @@ Converting from Avrotize Schema:
106
106
  - [`avrotize a2neo4j`](#convert-avrotize-schema-to-neo4j-schema) - Convert Avrotize Schema to Neo4j schema.
107
107
  - [`avrotize a2dp`](#convert-avrotize-schema-to-datapackage-schema) - Convert Avrotize Schema to Datapackage schema.
108
108
  - [`avrotize a2md`](#convert-avrotize-schema-to-markdown-documentation) - Convert Avrotize Schema to Markdown documentation.
109
- - [`avrotize struct2md`](#convert-json-structure-schema-to-markdown-documentation) - Convert JSON Structure schema to Markdown documentation.
109
+ - [`avrotize s2md`](#convert-json-structure-schema-to-markdown-documentation) - Convert JSON Structure schema to Markdown documentation.
110
110
 
111
111
  Direct conversions (JSON Structure):
112
112
 
@@ -137,7 +137,10 @@ Generate code from JSON Structure:
137
137
  Direct JSON Structure conversions:
138
138
 
139
139
  - [`avrotize s2csv`](#convert-json-structure-to-csv-schema) - Convert JSON Structure schema to CSV schema.
140
+ - [`avrotize a2csv`](#convert-avrotize-schema-to-csv-schema) - Convert Avrotize schema to CSV schema.
140
141
  - [`avrotize s2x`](#convert-json-structure-to-xml-schema-xsd) - Convert JSON Structure to XML Schema (XSD).
142
+ - [`avrotize s2graphql`](#convert-json-structure-schema-to-graphql-schema) - Convert JSON Structure schema to GraphQL schema.
143
+ - [`avrotize a2graphql`](#convert-avrotize-schema-to-graphql-schema) - Convert Avrotize schema to GraphQL schema.
141
144
 
142
145
  Other commands:
143
146
 
@@ -147,10 +150,6 @@ JSON Structure conversions:
147
150
 
148
151
  - [`avrotize s2dp`](#convert-json-structure-schema-to-datapackage-schema) - Convert JSON Structure schema to Datapackage schema.
149
152
 
150
- Direct conversions (not via Avrotize Schema):
151
-
152
- - [`avrotize struct2gql`](#convert-json-structure-schema-to-graphql-schema) - Convert JSON Structure schema to GraphQL schema.
153
-
154
153
  ## Overview
155
154
 
156
155
  You can use Avrotize to convert between Avro/Avrotize Schema and other schema formats like JSON Schema, XML Schema (XSD), Protocol Buffers (Protobuf), ASN.1, and database schema formats like Kusto Data Table Definition (KQL) and SQL Table Definition. That means you can also convert from JSON Schema to Protobuf going via Avrotize Schema.
@@ -489,7 +488,7 @@ For detailed conversion rules and type mappings for each SQL dialect, refer to t
489
488
  ### Convert JSON Structure Schema to SQL Schema
490
489
 
491
490
  ```bash
492
- avrotize struct2sql [input] --out <path_to_sql_script> --dialect <dialect> [--emit-cloudevents-columns]
491
+ avrotize s2sql [input] --out <path_to_sql_script> --dialect <dialect> [--emit-cloudevents-columns]
493
492
  ```
494
493
 
495
494
  Parameters:
@@ -545,7 +544,7 @@ Refer to the detailed conversion notes for Cassandra in the [NoSQL Conversion No
545
544
  ### Convert JSON Structure Schema to Cassandra Schema
546
545
 
547
546
  ```bash
548
- avrotize struct2cassandra [input] --out <output_file> [--emit-cloudevents-columns]
547
+ avrotize s2cassandra [input] --out <output_file> [--emit-cloudevents-columns]
549
548
  ```
550
549
 
551
550
  Parameters:
@@ -1153,7 +1152,7 @@ Conversion notes:
1153
1152
  ### Convert JSON Structure schema to Markdown documentation
1154
1153
 
1155
1154
  ```bash
1156
- avrotize struct2md <path_to_structure_schema_file> [--out <path_to_markdown_file>]
1155
+ avrotize s2md <path_to_structure_schema_file> [--out <path_to_markdown_file>]
1157
1156
  ```
1158
1157
 
1159
1158
  Parameters:
@@ -1201,6 +1200,25 @@ Conversion notes:
1201
1200
  - Enum and const keywords are supported and preserved in the output.
1202
1201
  - JSON Structure-specific features like `$ref`, `$extends`, definitions, and namespaces are resolved during conversion.
1203
1202
 
1203
+ ### Convert Avrotize Schema to CSV Schema
1204
+
1205
+ ```bash
1206
+ avrotize a2csv <path_to_avro_schema_file> [--out <path_to_csv_schema_file>]
1207
+ ```
1208
+
1209
+ Parameters:
1210
+
1211
+ - `<path_to_avro_schema_file>`: The path to the Avrotize schema file to be converted. If omitted, the file is read from stdin.
1212
+ - `--out`: The path to the CSV schema file to write the conversion result to. If omitted, the output is directed to stdout.
1213
+
1214
+ Conversion notes:
1215
+
1216
+ - The tool converts Avrotize schemas to CSV Schema format.
1217
+ - Avro primitive types (string, int, long, float, double, boolean, bytes) are mapped to appropriate CSV schema types.
1218
+ - Avro logical types (date, timestamp-millis, decimal, uuid) are preserved in the output.
1219
+ - Complex types (records, arrays, maps) are represented as strings in CSV schema, as CSV format doesn't have native support for nested structures.
1220
+ - Only single record types can be converted to CSV schema.
1221
+
1204
1222
  ### Convert JSON Structure to Protocol Buffers
1205
1223
 
1206
1224
  ```bash
@@ -1283,7 +1301,7 @@ Conversion notes:
1283
1301
  ### Convert JSON Structure schema to GraphQL schema
1284
1302
 
1285
1303
  ```bash
1286
- avrotize struct2gql [input] --out <path_to_graphql_schema_file>
1304
+ avrotize s2graphql [input] --out <path_to_graphql_schema_file>
1287
1305
  ```
1288
1306
 
1289
1307
  Parameters:
@@ -1308,12 +1326,43 @@ Example:
1308
1326
 
1309
1327
  ```bash
1310
1328
  # Convert a JSON Structure schema to GraphQL
1311
- avrotize struct2gql myschema.struct.json --out myschema.graphql
1329
+ avrotize s2graphql myschema.struct.json --out myschema.graphql
1312
1330
 
1313
1331
  # Read from stdin and write to stdout
1314
- cat myschema.struct.json | avrotize struct2gql > myschema.graphql
1332
+ cat myschema.struct.json | avrotize s2graphql > myschema.graphql
1333
+ ```
1334
+
1335
+ ### Convert Avrotize schema to GraphQL schema
1336
+
1337
+ ```bash
1338
+ avrotize a2graphql [input] --out <path_to_graphql_schema_file>
1315
1339
  ```
1316
1340
 
1341
+ Parameters:
1342
+
1343
+ - `[input]`: The path to the Avrotize schema file. If omitted, the file is read from stdin.
1344
+ - `--out <path_to_graphql_schema_file>`: The path to the output GraphQL schema file.
1345
+
1346
+ Conversion notes:
1347
+
1348
+ - Converts Avrotize schema to GraphQL schema language (SDL)
1349
+ - Avro primitive types (string, int, long, float, double, boolean, bytes) are mapped to GraphQL scalar types
1350
+ - Avro logical types (date, timestamp-millis, decimal, uuid) are mapped to custom GraphQL scalars
1351
+ - Avro record types become GraphQL object types
1352
+ - Avro arrays become GraphQL lists `[Type]`
1353
+ - Avro maps are represented using the JSON scalar type
1354
+ - Avro unions are converted to GraphQL union types
1355
+ - Avro enums become GraphQL enum types
1356
+
1357
+ Example:
1358
+
1359
+ ```bash
1360
+ # Convert an Avrotize schema to GraphQL
1361
+ avrotize a2graphql myschema.avsc --out myschema.graphql
1362
+
1363
+ # Read from stdin and write to stdout
1364
+ cat myschema.avsc | avrotize a2graphql > myschema.graphql
1365
+ ```
1317
1366
 
1318
1367
  This document provides an overview of the usage and functionality of Avrotize. For more detailed information, please refer to the [Avrotize Schema documentation](specs/avrotize-schema.md) and the individual command help messages.
1319
1368
 
@@ -42,13 +42,13 @@ Converting from Avrotize Schema:
42
42
  - [`avrotize a2k`](#convert-avrotize-schema-to-kusto-table-declaration) - Convert Avrotize Schema to Kusto table definition.
43
43
  - [`avrotize s2k`](#convert-json-structure-schema-to-kusto-table-declaration) - Convert JSON Structure Schema to Kusto table definition.
44
44
  - [`avrotize a2sql`](#convert-avrotize-schema-to-sql-table-definition) - Convert Avrotize Schema to SQL table definition.
45
- - [`avrotize struct2sql`](#convert-json-structure-schema-to-sql-schema) - Convert JSON Structure Schema to SQL table definition.
45
+ - [`avrotize s2sql`](#convert-json-structure-schema-to-sql-schema) - Convert JSON Structure Schema to SQL table definition.
46
46
  - [`avrotize a2pq`](#convert-avrotize-schema-to-empty-parquet-file) - Convert Avrotize Schema to Parquet or Iceberg schema.
47
47
  - [`avrotize a2ib`](#convert-avrotize-schema-to-iceberg-schema) - Convert Avrotize Schema to Iceberg schema.
48
48
  - [`avrotize s2ib`](#convert-json-structure-to-iceberg-schema) - Convert JSON Structure to Iceberg schema.
49
49
  - [`avrotize a2mongo`](#convert-avrotize-schema-to-mongodb-schema) - Convert Avrotize Schema to MongoDB schema.
50
50
  - [`avrotize a2cassandra`](#convert-avrotize-schema-to-cassandra-schema) - Convert Avrotize Schema to Cassandra schema.
51
- - [`avrotize struct2cassandra`](#convert-json-structure-schema-to-cassandra-schema) - Convert JSON Structure Schema to Cassandra schema.
51
+ - [`avrotize s2cassandra`](#convert-json-structure-schema-to-cassandra-schema) - Convert JSON Structure Schema to Cassandra schema.
52
52
  - [`avrotize a2es`](#convert-avrotize-schema-to-elasticsearch-schema) - Convert Avrotize Schema to Elasticsearch schema.
53
53
  - [`avrotize a2dynamodb`](#convert-avrotize-schema-to-dynamodb-schema) - Convert Avrotize Schema to DynamoDB schema.
54
54
  - [`avrotize a2cosmos`](#convert-avrotize-schema-to-cosmosdb-schema) - Convert Avrotize Schema to CosmosDB schema.
@@ -58,7 +58,7 @@ Converting from Avrotize Schema:
58
58
  - [`avrotize a2neo4j`](#convert-avrotize-schema-to-neo4j-schema) - Convert Avrotize Schema to Neo4j schema.
59
59
  - [`avrotize a2dp`](#convert-avrotize-schema-to-datapackage-schema) - Convert Avrotize Schema to Datapackage schema.
60
60
  - [`avrotize a2md`](#convert-avrotize-schema-to-markdown-documentation) - Convert Avrotize Schema to Markdown documentation.
61
- - [`avrotize struct2md`](#convert-json-structure-schema-to-markdown-documentation) - Convert JSON Structure schema to Markdown documentation.
61
+ - [`avrotize s2md`](#convert-json-structure-schema-to-markdown-documentation) - Convert JSON Structure schema to Markdown documentation.
62
62
 
63
63
  Direct conversions (JSON Structure):
64
64
 
@@ -89,7 +89,10 @@ Generate code from JSON Structure:
89
89
  Direct JSON Structure conversions:
90
90
 
91
91
  - [`avrotize s2csv`](#convert-json-structure-to-csv-schema) - Convert JSON Structure schema to CSV schema.
92
+ - [`avrotize a2csv`](#convert-avrotize-schema-to-csv-schema) - Convert Avrotize schema to CSV schema.
92
93
  - [`avrotize s2x`](#convert-json-structure-to-xml-schema-xsd) - Convert JSON Structure to XML Schema (XSD).
94
+ - [`avrotize s2graphql`](#convert-json-structure-schema-to-graphql-schema) - Convert JSON Structure schema to GraphQL schema.
95
+ - [`avrotize a2graphql`](#convert-avrotize-schema-to-graphql-schema) - Convert Avrotize schema to GraphQL schema.
93
96
 
94
97
  Other commands:
95
98
 
@@ -99,10 +102,6 @@ JSON Structure conversions:
99
102
 
100
103
  - [`avrotize s2dp`](#convert-json-structure-schema-to-datapackage-schema) - Convert JSON Structure schema to Datapackage schema.
101
104
 
102
- Direct conversions (not via Avrotize Schema):
103
-
104
- - [`avrotize struct2gql`](#convert-json-structure-schema-to-graphql-schema) - Convert JSON Structure schema to GraphQL schema.
105
-
106
105
  ## Overview
107
106
 
108
107
  You can use Avrotize to convert between Avro/Avrotize Schema and other schema formats like JSON Schema, XML Schema (XSD), Protocol Buffers (Protobuf), ASN.1, and database schema formats like Kusto Data Table Definition (KQL) and SQL Table Definition. That means you can also convert from JSON Schema to Protobuf going via Avrotize Schema.
@@ -441,7 +440,7 @@ For detailed conversion rules and type mappings for each SQL dialect, refer to t
441
440
  ### Convert JSON Structure Schema to SQL Schema
442
441
 
443
442
  ```bash
444
- avrotize struct2sql [input] --out <path_to_sql_script> --dialect <dialect> [--emit-cloudevents-columns]
443
+ avrotize s2sql [input] --out <path_to_sql_script> --dialect <dialect> [--emit-cloudevents-columns]
445
444
  ```
446
445
 
447
446
  Parameters:
@@ -497,7 +496,7 @@ Refer to the detailed conversion notes for Cassandra in the [NoSQL Conversion No
497
496
  ### Convert JSON Structure Schema to Cassandra Schema
498
497
 
499
498
  ```bash
500
- avrotize struct2cassandra [input] --out <output_file> [--emit-cloudevents-columns]
499
+ avrotize s2cassandra [input] --out <output_file> [--emit-cloudevents-columns]
501
500
  ```
502
501
 
503
502
  Parameters:
@@ -1105,7 +1104,7 @@ Conversion notes:
1105
1104
  ### Convert JSON Structure schema to Markdown documentation
1106
1105
 
1107
1106
  ```bash
1108
- avrotize struct2md <path_to_structure_schema_file> [--out <path_to_markdown_file>]
1107
+ avrotize s2md <path_to_structure_schema_file> [--out <path_to_markdown_file>]
1109
1108
  ```
1110
1109
 
1111
1110
  Parameters:
@@ -1153,6 +1152,25 @@ Conversion notes:
1153
1152
  - Enum and const keywords are supported and preserved in the output.
1154
1153
  - JSON Structure-specific features like `$ref`, `$extends`, definitions, and namespaces are resolved during conversion.
1155
1154
 
1155
+ ### Convert Avrotize Schema to CSV Schema
1156
+
1157
+ ```bash
1158
+ avrotize a2csv <path_to_avro_schema_file> [--out <path_to_csv_schema_file>]
1159
+ ```
1160
+
1161
+ Parameters:
1162
+
1163
+ - `<path_to_avro_schema_file>`: The path to the Avrotize schema file to be converted. If omitted, the file is read from stdin.
1164
+ - `--out`: The path to the CSV schema file to write the conversion result to. If omitted, the output is directed to stdout.
1165
+
1166
+ Conversion notes:
1167
+
1168
+ - The tool converts Avrotize schemas to CSV Schema format.
1169
+ - Avro primitive types (string, int, long, float, double, boolean, bytes) are mapped to appropriate CSV schema types.
1170
+ - Avro logical types (date, timestamp-millis, decimal, uuid) are preserved in the output.
1171
+ - Complex types (records, arrays, maps) are represented as strings in CSV schema, as CSV format doesn't have native support for nested structures.
1172
+ - Only single record types can be converted to CSV schema.
1173
+
1156
1174
  ### Convert JSON Structure to Protocol Buffers
1157
1175
 
1158
1176
  ```bash
@@ -1235,7 +1253,7 @@ Conversion notes:
1235
1253
  ### Convert JSON Structure schema to GraphQL schema
1236
1254
 
1237
1255
  ```bash
1238
- avrotize struct2gql [input] --out <path_to_graphql_schema_file>
1256
+ avrotize s2graphql [input] --out <path_to_graphql_schema_file>
1239
1257
  ```
1240
1258
 
1241
1259
  Parameters:
@@ -1260,11 +1278,42 @@ Example:
1260
1278
 
1261
1279
  ```bash
1262
1280
  # Convert a JSON Structure schema to GraphQL
1263
- avrotize struct2gql myschema.struct.json --out myschema.graphql
1281
+ avrotize s2graphql myschema.struct.json --out myschema.graphql
1264
1282
 
1265
1283
  # Read from stdin and write to stdout
1266
- cat myschema.struct.json | avrotize struct2gql > myschema.graphql
1284
+ cat myschema.struct.json | avrotize s2graphql > myschema.graphql
1285
+ ```
1286
+
1287
+ ### Convert Avrotize schema to GraphQL schema
1288
+
1289
+ ```bash
1290
+ avrotize a2graphql [input] --out <path_to_graphql_schema_file>
1267
1291
  ```
1268
1292
 
1293
+ Parameters:
1294
+
1295
+ - `[input]`: The path to the Avrotize schema file. If omitted, the file is read from stdin.
1296
+ - `--out <path_to_graphql_schema_file>`: The path to the output GraphQL schema file.
1297
+
1298
+ Conversion notes:
1299
+
1300
+ - Converts Avrotize schema to GraphQL schema language (SDL)
1301
+ - Avro primitive types (string, int, long, float, double, boolean, bytes) are mapped to GraphQL scalar types
1302
+ - Avro logical types (date, timestamp-millis, decimal, uuid) are mapped to custom GraphQL scalars
1303
+ - Avro record types become GraphQL object types
1304
+ - Avro arrays become GraphQL lists `[Type]`
1305
+ - Avro maps are represented using the JSON scalar type
1306
+ - Avro unions are converted to GraphQL union types
1307
+ - Avro enums become GraphQL enum types
1308
+
1309
+ Example:
1310
+
1311
+ ```bash
1312
+ # Convert an Avrotize schema to GraphQL
1313
+ avrotize a2graphql myschema.avsc --out myschema.graphql
1314
+
1315
+ # Read from stdin and write to stdout
1316
+ cat myschema.avsc | avrotize a2graphql > myschema.graphql
1317
+ ```
1269
1318
 
1270
1319
  This document provides an overview of the usage and functionality of Avrotize. For more detailed information, please refer to the [Avrotize Schema documentation](specs/avrotize-schema.md) and the individual command help messages.
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '2.22.1'
32
- __version_tuple__ = version_tuple = (2, 22, 1)
31
+ __version__ = version = '3.0.0'
32
+ __version_tuple__ = version_tuple = (3, 0, 0)
33
33
 
34
- __commit_id__ = commit_id = 'g09745f1ba'
34
+ __commit_id__ = commit_id = 'gb201f8a65'
@@ -166,7 +166,18 @@ public class {{ test_class_name }}
166
166
  Assert.That(newInstance, Is.EqualTo(_instance));
167
167
  }
168
168
  {%- endif %}
169
- {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or msgpack_annotation or protobuf_net_annotation %}
169
+ {%- if cbor_annotation %}
170
+ /// <summary> Testing CBOR serializer </summary>
171
+ [Test]
172
+ public void Test_ToByteArray_FromData_Cbor()
173
+ {
174
+ var mediaType = "application/cbor";
175
+ var bytes = _instance.ToByteArray(mediaType);
176
+ var newInstance = {{ class_base_name }}.FromData(bytes, mediaType);
177
+ Assert.That(newInstance, Is.EqualTo(_instance));
178
+ }
179
+ {%- endif %}
180
+ {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or msgpack_annotation or cbor_annotation or protobuf_net_annotation %}
170
181
 
171
182
  /// <summary> Testing FromData with edge cases </summary>
172
183
  [Test]
@@ -188,6 +199,9 @@ public class {{ test_class_name }}
188
199
  {%- elif msgpack_annotation %}
189
200
  // Test null data - FromData returns null for null input
190
201
  Assert.That({{ class_base_name }}.FromData((byte[])null!, "application/msgpack"), Is.Null);
202
+ {%- elif cbor_annotation %}
203
+ // Test null data - FromData returns null for null input
204
+ Assert.That({{ class_base_name }}.FromData((byte[])null!, "application/cbor"), Is.Null);
191
205
  {%- elif protobuf_net_annotation %}
192
206
  // Test null data - FromData returns null for null input
193
207
  Assert.That({{ class_base_name }}.FromData((byte[])null!, "application/x-protobuf"), Is.Null);
@@ -242,7 +256,24 @@ public class {{ test_class_name }}
242
256
  Assert.That(newInstance, Is.EqualTo(_instance));
243
257
  }
244
258
  {%- endif %}
245
- {%- if protobuf_net_annotation and not (system_text_json_annotation or newtonsoft_json_annotation or msgpack_annotation) %}
259
+ {%- if cbor_annotation and not (system_text_json_annotation or newtonsoft_json_annotation or msgpack_annotation) %}
260
+
261
+ /// <summary> Testing Gzip compression with CBOR </summary>
262
+ [Test]
263
+ public void Test_ToByteArray_Gzip_Cbor()
264
+ {
265
+ var mediaType = "application/cbor";
266
+ var gzipMediaType = "application/cbor+gzip";
267
+ var plainBytes = _instance.ToByteArray(mediaType);
268
+ var gzipBytes = _instance.ToByteArray(gzipMediaType);
269
+ // Gzip compressed data should start with magic bytes 0x1f 0x8b
270
+ Assert.That(gzipBytes.Length >= 2 && gzipBytes[0] == 0x1f && gzipBytes[1] == 0x8b, Is.True,
271
+ "Gzip compressed data should have correct magic bytes");
272
+ var newInstance = {{ class_base_name }}.FromData(gzipBytes, gzipMediaType);
273
+ Assert.That(newInstance, Is.EqualTo(_instance));
274
+ }
275
+ {%- endif %}
276
+ {%- if protobuf_net_annotation and not (system_text_json_annotation or newtonsoft_json_annotation or msgpack_annotation or cbor_annotation) %}
246
277
 
247
278
  /// <summary> Testing Gzip compression with Protobuf </summary>
248
279
  [Test]
@@ -1,4 +1,4 @@
1
- {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation %}
1
+ {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation or cbor_annotation %}
2
2
  /// <summary>
3
3
  /// Creates an object from the data
4
4
  /// </summary>
@@ -11,7 +11,7 @@
11
11
  if ( data is {{ class_name }}) return ({{ class_name }})data;
12
12
  if ( contentTypeString == null ) contentTypeString = System.Net.Mime.MediaTypeNames.Application.Octet;
13
13
  var contentType = new System.Net.Mime.ContentType(contentTypeString);
14
- {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation %}
14
+ {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation or cbor_annotation %}
15
15
  if ( contentType.MediaType.EndsWith("+gzip"))
16
16
  {
17
17
  var stream = data switch
@@ -149,12 +149,25 @@
149
149
  };
150
150
  return MessagePack.MessagePackSerializer.Deserialize<{{ class_name }}>(bytes);
151
151
  }
152
+ {%- endif %}
153
+ {%- if cbor_annotation %}
154
+ if (contentType.MediaType.StartsWith("application/cbor"))
155
+ {
156
+ var bytes = data switch
157
+ {
158
+ byte[] b => b,
159
+ System.IO.Stream s => ReadStreamToBytes(s),
160
+ System.BinaryData bd => bd.ToArray(),
161
+ _ => throw new NotSupportedException("Data type not supported for CBOR")
162
+ };
163
+ return Dahomey.Cbor.Cbor.Deserialize<{{ class_name }}>(new ReadOnlySpan<byte>(bytes));
164
+ }
152
165
  {%- endif %}
153
166
  throw new System.NotSupportedException($"Unsupported media type {contentType.MediaType}");
154
167
  }
155
168
  {%- endif %}
156
169
 
157
- {%- if msgpack_annotation %}
170
+ {%- if msgpack_annotation or cbor_annotation %}
158
171
  private static byte[] ReadStreamToBytes(System.IO.Stream stream)
159
172
  {
160
173
  using (var memoryStream = new System.IO.MemoryStream())
@@ -190,7 +203,7 @@
190
203
  {%- if avro_annotation %}
191
204
  {%- endif%}
192
205
 
193
- {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation %}
206
+ {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation or cbor_annotation %}
194
207
  /// <summary>
195
208
  /// Converts the object to a byte array
196
209
  /// </summary>
@@ -263,7 +276,15 @@
263
276
  result = MessagePack.MessagePackSerializer.Serialize(this);
264
277
  }
265
278
  {%- endif %}
266
- {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation %}
279
+ {%- if cbor_annotation %}
280
+ if (contentType.MediaType.StartsWith("application/cbor"))
281
+ {
282
+ var bufferWriter = new System.Buffers.ArrayBufferWriter<byte>();
283
+ Dahomey.Cbor.Cbor.Serialize(this, bufferWriter);
284
+ result = bufferWriter.WrittenSpan.ToArray();
285
+ }
286
+ {%- endif %}
287
+ {%- if avro_annotation or system_text_json_annotation or newtonsoft_json_annotation or system_xml_annotation or protobuf_net_annotation or msgpack_annotation or cbor_annotation %}
267
288
  if (result != null && contentType.MediaType.EndsWith("+gzip"))
268
289
  {
269
290
  var stream = new System.IO.MemoryStream();
@@ -20,6 +20,9 @@
20
20
  {%- if msgpack_annotation %}
21
21
  <PackageReference Include="MessagePack" Version="{{ MSGPACK_VERSION }}" />
22
22
  {%- endif %}
23
+ {%- if cbor_annotation %}
24
+ <PackageReference Include="Dahomey.Cbor" Version="{{ CBOR_VERSION }}" />
25
+ {%- endif %}
23
26
  <PackageReference Include="System.Memory.Data" Version="{{ SYSTEM_MEMORY_DATA_VERSION }}" />
24
27
  </ItemGroup>
25
28
  <ItemGroup>
@@ -16,6 +16,7 @@ from avrotize.constants import (
16
16
  SYSTEM_MEMORY_DATA_VERSION,
17
17
  PROTOBUF_NET_VERSION,
18
18
  MSGPACK_VERSION,
19
+ CBOR_VERSION,
19
20
  NUNIT_VERSION,
20
21
  NUNIT_ADAPTER_VERSION,
21
22
  MSTEST_SDK_VERSION,
@@ -53,6 +54,7 @@ class AvroToCSharp:
53
54
  self.newtonsoft_json_annotation = False
54
55
  self.system_xml_annotation = False
55
56
  self.msgpack_annotation = False
57
+ self.cbor_annotation = False
56
58
  self.avro_annotation = False
57
59
  self.protobuf_net_annotation = False
58
60
  self.generated_types: Dict[str,str] = {}
@@ -267,6 +269,7 @@ class AvroToCSharp:
267
269
  newtonsoft_json_annotation=self.newtonsoft_json_annotation,
268
270
  system_xml_annotation=self.system_xml_annotation,
269
271
  msgpack_annotation=self.msgpack_annotation,
272
+ cbor_annotation=self.cbor_annotation,
270
273
  json_match_clauses=self.create_is_json_match_clauses(avro_schema, avro_namespace, class_name)
271
274
  )
272
275
 
@@ -768,6 +771,10 @@ class AvroToCSharp:
768
771
  if self.msgpack_annotation:
769
772
  prop += f"{INDENT}[Key({field_index})]\n"
770
773
 
774
+ # Add CBOR serialization attribute if enabled
775
+ if self.cbor_annotation:
776
+ prop += f"{INDENT}[Dahomey.Cbor.Attributes.CborProperty(\"{annotation_name}\")]\n"
777
+
771
778
  if self.system_text_json_annotation:
772
779
  prop += f"{INDENT}[System.Text.Json.Serialization.JsonPropertyName(\"{annotation_name}\")]\n"
773
780
  if is_enum_type:
@@ -831,6 +838,8 @@ class AvroToCSharp:
831
838
  file_content += "using System.Xml.Serialization;\n"
832
839
  if self.msgpack_annotation: # Add MessagePack serialization using directive
833
840
  file_content += "using MessagePack;\n"
841
+ if self.cbor_annotation: # Add CBOR serialization using directive
842
+ file_content += "using Dahomey.Cbor.Attributes;\n"
834
843
 
835
844
  if namespace:
836
845
  # Namespace declaration with correct indentation for the definition
@@ -874,7 +883,8 @@ class AvroToCSharp:
874
883
  system_text_json_annotation=self.system_text_json_annotation,
875
884
  newtonsoft_json_annotation=self.newtonsoft_json_annotation,
876
885
  protobuf_net_annotation=self.protobuf_net_annotation,
877
- msgpack_annotation=self.msgpack_annotation
886
+ msgpack_annotation=self.msgpack_annotation,
887
+ cbor_annotation=self.cbor_annotation
878
888
  )
879
889
  elif type_kind == "enum":
880
890
  test_class_definition = process_template(
@@ -1028,12 +1038,14 @@ class AvroToCSharp:
1028
1038
  newtonsoft_json_annotation=self.newtonsoft_json_annotation,
1029
1039
  protobuf_net_annotation=self.protobuf_net_annotation,
1030
1040
  msgpack_annotation=self.msgpack_annotation,
1041
+ cbor_annotation=self.cbor_annotation,
1031
1042
  CSHARP_AVRO_VERSION=CSHARP_AVRO_VERSION,
1032
1043
  NEWTONSOFT_JSON_VERSION=NEWTONSOFT_JSON_VERSION,
1033
1044
  SYSTEM_TEXT_JSON_VERSION=SYSTEM_TEXT_JSON_VERSION,
1034
1045
  SYSTEM_MEMORY_DATA_VERSION=SYSTEM_MEMORY_DATA_VERSION,
1035
1046
  PROTOBUF_NET_VERSION=PROTOBUF_NET_VERSION,
1036
1047
  MSGPACK_VERSION=MSGPACK_VERSION,
1048
+ CBOR_VERSION=CBOR_VERSION,
1037
1049
  NUNIT_VERSION=NUNIT_VERSION,
1038
1050
  NUNIT_ADAPTER_VERSION=NUNIT_ADAPTER_VERSION,
1039
1051
  MSTEST_SDK_VERSION=MSTEST_SDK_VERSION))
@@ -1107,6 +1119,7 @@ def convert_avro_to_csharp(
1107
1119
  newtonsoft_json_annotation=False,
1108
1120
  system_xml_annotation=False,
1109
1121
  msgpack_annotation=False,
1122
+ cbor_annotation=False,
1110
1123
  avro_annotation=False,
1111
1124
  protobuf_net_annotation=False
1112
1125
  ):
@@ -1122,6 +1135,7 @@ def convert_avro_to_csharp(
1122
1135
  newtonsoft_json_annotation (bool, optional): Use Newtonsoft.Json annotations. Defaults to False.
1123
1136
  system_xml_annotation (bool, optional): Use System.Xml.Serialization annotations. Defaults to False.
1124
1137
  msgpack_annotation (bool, optional): Use MessagePack annotations. Defaults to False.
1138
+ cbor_annotation (bool, optional): Use Dahomey.Cbor annotations. Defaults to False.
1125
1139
  avro_annotation (bool, optional): Use Avro annotations. Defaults to False.
1126
1140
  protobuf_net_annotation (bool, optional): Use protobuf-net annotations. Defaults to False.
1127
1141
  """
@@ -1135,6 +1149,7 @@ def convert_avro_to_csharp(
1135
1149
  avrotocs.newtonsoft_json_annotation = newtonsoft_json_annotation
1136
1150
  avrotocs.system_xml_annotation = system_xml_annotation
1137
1151
  avrotocs.msgpack_annotation = msgpack_annotation
1152
+ avrotocs.cbor_annotation = cbor_annotation
1138
1153
  avrotocs.avro_annotation = avro_annotation
1139
1154
  avrotocs.protobuf_net_annotation = protobuf_net_annotation
1140
1155
  avrotocs.convert(avro_schema_path, cs_file_path)
@@ -1150,6 +1165,7 @@ def convert_avro_schema_to_csharp(
1150
1165
  newtonsoft_json_annotation: bool = False,
1151
1166
  system_xml_annotation: bool = False,
1152
1167
  msgpack_annotation: bool = False,
1168
+ cbor_annotation: bool = False,
1153
1169
  avro_annotation: bool = False,
1154
1170
  protobuf_net_annotation: bool = False
1155
1171
  ):
@@ -1165,6 +1181,7 @@ def convert_avro_schema_to_csharp(
1165
1181
  newtonsoft_json_annotation (bool, optional): Use Newtonsoft.Json annotations. Defaults to False.
1166
1182
  system_xml_annotation (bool, optional): Use System.Xml.Serialization annotations. Defaults to False.
1167
1183
  msgpack_annotation (bool, optional): Use MessagePack annotations. Defaults to False.
1184
+ cbor_annotation (bool, optional): Use Dahomey.Cbor annotations. Defaults to False.
1168
1185
  avro_annotation (bool, optional): Use Avro annotations. Defaults to False.
1169
1186
  protobuf_net_annotation (bool, optional): Use protobuf-net annotations. Defaults to False.
1170
1187
  """
@@ -1175,6 +1192,7 @@ def convert_avro_schema_to_csharp(
1175
1192
  avrotocs.newtonsoft_json_annotation = newtonsoft_json_annotation
1176
1193
  avrotocs.system_xml_annotation = system_xml_annotation
1177
1194
  avrotocs.msgpack_annotation = msgpack_annotation
1195
+ avrotocs.cbor_annotation = cbor_annotation
1178
1196
  avrotocs.avro_annotation = avro_annotation
1179
1197
  avrotocs.protobuf_net_annotation = protobuf_net_annotation
1180
1198
  avrotocs.convert_schema(avro_schema, output_dir)
@@ -39,7 +39,23 @@ class AvroToCSVSchemaConverter:
39
39
 
40
40
  :param avro_schema: Avro schema as a dictionary.
41
41
  :return: CSV schema as a dictionary.
42
+ :raises ValueError: If the schema is not a single record type.
42
43
  """
44
+ # Handle schema arrays (unions of records) - not supported
45
+ if isinstance(avro_schema, list):
46
+ raise ValueError(
47
+ "CSV schema conversion only supports single record schemas. "
48
+ "The provided schema is an array/union of multiple types. "
49
+ "Use --record-type to specify a single record type if available."
50
+ )
51
+
52
+ # Ensure it's a record type with fields
53
+ if not isinstance(avro_schema, dict) or 'fields' not in avro_schema:
54
+ raise ValueError(
55
+ "CSV schema conversion only supports Avro record types with 'fields'. "
56
+ f"The provided schema has type: {avro_schema.get('type', 'unknown') if isinstance(avro_schema, dict) else type(avro_schema).__name__}"
57
+ )
58
+
43
59
  csv_schema = {
44
60
  "fields": []
45
61
  }