avrotize 3.0.2__tar.gz → 3.1.1__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 (176) hide show
  1. avrotize-3.0.2/README.md → avrotize-3.1.1/PKG-INFO +267 -0
  2. avrotize-3.0.2/PKG-INFO → avrotize-3.1.1/README.md +205 -49
  3. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/_version.py +3 -3
  4. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotize.py +4 -0
  5. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/class_core.ts.jinja +2 -2
  6. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots.py +62 -7
  7. avrotize-3.1.1/avrotize/avrovalidator.py +518 -0
  8. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/commands.json +466 -0
  9. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/cs/net90/dependencies.csproj +4 -4
  10. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/java/jdk21/pom.xml +6 -6
  11. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/typescript/node22/package.json +1 -1
  12. avrotize-3.1.1/avrotize/jsontoschema.py +151 -0
  13. avrotize-3.1.1/avrotize/schema_inference.py +825 -0
  14. avrotize-3.1.1/avrotize/sqltoavro.py +1159 -0
  15. avrotize-3.1.1/avrotize/validate.py +242 -0
  16. avrotize-3.1.1/avrotize/xmltoschema.py +122 -0
  17. {avrotize-3.0.2 → avrotize-3.1.1}/pyproject.toml +19 -1
  18. {avrotize-3.0.2 → avrotize-3.1.1}/LICENSE +0 -0
  19. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/__init__.py +0 -0
  20. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/__main__.py +0 -0
  21. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/asn1toavro.py +0 -0
  22. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocpp/CMakeLists.txt.jinja +0 -0
  23. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocpp/build.bat.jinja +0 -0
  24. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocpp/build.sh.jinja +0 -0
  25. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocpp/dataclass_body.jinja +0 -0
  26. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocpp/vcpkg.json.jinja +0 -0
  27. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocpp.py +0 -0
  28. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/README.md.jinja +0 -0
  29. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/class_test.cs.jinja +0 -0
  30. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/dataclass_core.jinja +0 -0
  31. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/enum_test.cs.jinja +0 -0
  32. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/project.csproj.jinja +0 -0
  33. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/project.sln.jinja +0 -0
  34. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/run_coverage.ps1.jinja +0 -0
  35. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/run_coverage.sh.jinja +0 -0
  36. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp/testproject.csproj.jinja +0 -0
  37. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsharp.py +0 -0
  38. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotocsv.py +0 -0
  39. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotodatapackage.py +0 -0
  40. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotodb.py +0 -0
  41. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotogo/go_enum.jinja +0 -0
  42. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotogo/go_helpers.jinja +0 -0
  43. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotogo/go_struct.jinja +0 -0
  44. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotogo/go_test.jinja +0 -0
  45. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotogo/go_union.jinja +0 -0
  46. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotogo.py +0 -0
  47. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotographql.py +0 -0
  48. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotoiceberg.py +0 -0
  49. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojava/class_test.java.jinja +0 -0
  50. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojava/enum_test.java.jinja +0 -0
  51. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojava/testproject.pom.jinja +0 -0
  52. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojava.py +0 -0
  53. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojs.py +0 -0
  54. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojsons.py +0 -0
  55. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotojstruct.py +0 -0
  56. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotokusto.py +0 -0
  57. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotomd/README.md.jinja +0 -0
  58. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotomd.py +0 -0
  59. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotools.py +0 -0
  60. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotoparquet.py +0 -0
  61. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotoproto.py +0 -0
  62. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotopython/dataclass_core.jinja +0 -0
  63. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotopython/enum_core.jinja +0 -0
  64. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotopython/pyproject_toml.jinja +0 -0
  65. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotopython/test_class.jinja +0 -0
  66. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotopython/test_enum.jinja +0 -0
  67. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotopython.py +0 -0
  68. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotorust/dataclass_enum.rs.jinja +0 -0
  69. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotorust/dataclass_struct.rs.jinja +0 -0
  70. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotorust/dataclass_union.rs.jinja +0 -0
  71. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotorust.py +0 -0
  72. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/class_test.ts.jinja +0 -0
  73. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/enum_core.ts.jinja +0 -0
  74. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/gitignore.jinja +0 -0
  75. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/index.ts.jinja +0 -0
  76. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/package.json.jinja +0 -0
  77. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotots/tsconfig.json.jinja +0 -0
  78. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/avrotoxsd.py +0 -0
  79. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/cddltostructure.py +0 -0
  80. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/common.py +0 -0
  81. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/constants.py +0 -0
  82. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/csvtoavro.py +0 -0
  83. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/datapackagetoavro.py +0 -0
  84. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/cpp/vcpkg/vcpkg.json +0 -0
  85. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/go/go121/go.mod +0 -0
  86. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/python/py312/requirements.txt +0 -0
  87. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependencies/rust/stable/Cargo.toml +0 -0
  88. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependency_resolver.py +0 -0
  89. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/dependency_version.py +0 -0
  90. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/generic/generic.avsc +0 -0
  91. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/jsonstoavro.py +0 -0
  92. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/jsonstostructure.py +0 -0
  93. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/jstructtoavro.py +0 -0
  94. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/kstructtoavro.py +0 -0
  95. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/kustotoavro.py +0 -0
  96. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/openapitostructure.py +0 -0
  97. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/parquettoavro.py +0 -0
  98. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/proto2parser.py +0 -0
  99. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/proto3parser.py +0 -0
  100. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototoavro.py +0 -0
  101. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/any.avsc +0 -0
  102. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/api.avsc +0 -0
  103. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/duration.avsc +0 -0
  104. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/field_mask.avsc +0 -0
  105. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/struct.avsc +0 -0
  106. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/timestamp.avsc +0 -0
  107. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/type.avsc +0 -0
  108. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/prototypes/wrappers.avsc +0 -0
  109. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocddl.py +0 -0
  110. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocpp/CMakeLists.txt.jinja +0 -0
  111. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocpp/build.bat.jinja +0 -0
  112. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocpp/build.sh.jinja +0 -0
  113. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocpp/dataclass_body.jinja +0 -0
  114. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocpp/vcpkg.json.jinja +0 -0
  115. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocpp.py +0 -0
  116. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/class_test.cs.jinja +0 -0
  117. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/dataclass_core.jinja +0 -0
  118. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/enum_test.cs.jinja +0 -0
  119. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/json_structure_converters.cs.jinja +0 -0
  120. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/program.cs.jinja +0 -0
  121. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/project.csproj.jinja +0 -0
  122. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/project.sln.jinja +0 -0
  123. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/testproject.csproj.jinja +0 -0
  124. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp/tuple_converter.cs.jinja +0 -0
  125. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsharp.py +0 -0
  126. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretocsv.py +0 -0
  127. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretodatapackage.py +0 -0
  128. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretodb.py +0 -0
  129. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretogo/go_enum.jinja +0 -0
  130. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretogo/go_helpers.jinja +0 -0
  131. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretogo/go_interface.jinja +0 -0
  132. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretogo/go_struct.jinja +0 -0
  133. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretogo/go_test.jinja +0 -0
  134. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretogo.py +0 -0
  135. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretographql.py +0 -0
  136. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretoiceberg.py +0 -0
  137. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava/choice_core.jinja +0 -0
  138. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava/class_core.jinja +0 -0
  139. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava/enum_core.jinja +0 -0
  140. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava/equals_hashcode.jinja +0 -0
  141. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava/pom.xml.jinja +0 -0
  142. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava/tuple_core.jinja +0 -0
  143. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojava.py +0 -0
  144. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs/class_core.js.jinja +0 -0
  145. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs/enum_core.js.jinja +0 -0
  146. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs/package.json.jinja +0 -0
  147. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs/test_class.js.jinja +0 -0
  148. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs/test_enum.js.jinja +0 -0
  149. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs/test_runner.js.jinja +0 -0
  150. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojs.py +0 -0
  151. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretojsons.py +0 -0
  152. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretokusto.py +0 -0
  153. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretomd/README.md.jinja +0 -0
  154. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretomd.py +0 -0
  155. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretoproto.py +0 -0
  156. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython/dataclass_core.jinja +0 -0
  157. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython/enum_core.jinja +0 -0
  158. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython/map_alias.jinja +0 -0
  159. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython/pyproject_toml.jinja +0 -0
  160. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython/test_class.jinja +0 -0
  161. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython/test_enum.jinja +0 -0
  162. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretopython.py +0 -0
  163. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretorust/dataclass_enum.rs.jinja +0 -0
  164. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretorust/dataclass_struct.rs.jinja +0 -0
  165. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretorust/dataclass_union.rs.jinja +0 -0
  166. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretorust.py +0 -0
  167. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/class_core.ts.jinja +0 -0
  168. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/enum_core.ts.jinja +0 -0
  169. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/gitignore.jinja +0 -0
  170. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/index.ts.jinja +0 -0
  171. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/package.json.jinja +0 -0
  172. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/test_class.ts.jinja +0 -0
  173. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots/tsconfig.json.jinja +0 -0
  174. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretots.py +0 -0
  175. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/structuretoxsd.py +0 -0
  176. {avrotize-3.0.2 → avrotize-3.1.1}/avrotize/xsdtoavro.py +0 -0
@@ -1,3 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: avrotize
3
+ Version: 3.1.1
4
+ Summary: Tools to convert from and to Avro Schema from various other schema languages.
5
+ Author-email: Clemens Vasters <clemensv@microsoft.com>
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ License-File: LICENSE
12
+ Requires-Dist: jsonschema>=4.23.0
13
+ Requires-Dist: lark>=1.1.9
14
+ Requires-Dist: pyarrow>=22.0.0
15
+ Requires-Dist: asn1tools>=0.167.0
16
+ Requires-Dist: jsonpointer>=3.0.0
17
+ Requires-Dist: jsonpath-ng>=1.6.1
18
+ Requires-Dist: jsoncomparison>=1.1.0
19
+ Requires-Dist: requests>=2.32.3
20
+ Requires-Dist: azure-kusto-data>=5.0.5
21
+ Requires-Dist: azure-identity>=1.17.1
22
+ Requires-Dist: datapackage>=1.15.4
23
+ Requires-Dist: jinja2>=3.1.4
24
+ Requires-Dist: pyiceberg>=0.10.0
25
+ Requires-Dist: pandas>=2.2.2
26
+ Requires-Dist: docker>=7.1.0
27
+ Requires-Dist: cddlparser>=0.5.0
28
+ Requires-Dist: json-structure>=0.1.8
29
+ Requires-Dist: psycopg2-binary>=2.9.9 ; extra == "all-sql"
30
+ Requires-Dist: pymysql>=1.1.1 ; extra == "all-sql"
31
+ Requires-Dist: pyodbc>=5.1.0 ; extra == "all-sql"
32
+ Requires-Dist: oracledb>=2.3.0 ; extra == "all-sql"
33
+ Requires-Dist: pytest>=8.3.2 ; extra == "dev"
34
+ Requires-Dist: fastavro>=1.9.5 ; extra == "dev"
35
+ Requires-Dist: xmlschema>=3.3.2 ; extra == "dev"
36
+ Requires-Dist: xmlunittest>=1.0.1 ; extra == "dev"
37
+ Requires-Dist: pylint>=3.2.6 ; extra == "dev"
38
+ Requires-Dist: dataclasses_json>=0.6.7 ; extra == "dev"
39
+ Requires-Dist: dataclasses>=0.8 ; extra == "dev"
40
+ Requires-Dist: pydantic>=2.8.2 ; extra == "dev"
41
+ Requires-Dist: avro>=1.12.0 ; extra == "dev"
42
+ Requires-Dist: testcontainers>=4.7.2 ; extra == "dev"
43
+ Requires-Dist: pymysql>=1.1.1 ; extra == "dev"
44
+ Requires-Dist: psycopg2-binary>=2.9.9 ; extra == "dev"
45
+ Requires-Dist: pyodbc>=5.1.0 ; extra == "dev"
46
+ Requires-Dist: pymongo>=4.8.0 ; extra == "dev"
47
+ Requires-Dist: oracledb>=2.3.0 ; extra == "dev"
48
+ Requires-Dist: cassandra-driver>=3.29.1 ; extra == "dev"
49
+ Requires-Dist: sqlalchemy>=2.0.32 ; extra == "dev"
50
+ Requires-Dist: graphql-core>=3.2.0 ; extra == "dev"
51
+ Requires-Dist: pymysql>=1.1.1 ; extra == "mysql"
52
+ Requires-Dist: oracledb>=2.3.0 ; extra == "oracle"
53
+ Requires-Dist: psycopg2-binary>=2.9.9 ; extra == "postgres"
54
+ Requires-Dist: pyodbc>=5.1.0 ; extra == "sqlserver"
55
+ Provides-Extra: all-sql
56
+ Provides-Extra: dev
57
+ Provides-Extra: mysql
58
+ Provides-Extra: oracle
59
+ Provides-Extra: postgres
60
+ Provides-Extra: sqlserver
61
+
1
62
  # Avrotize & Structurize
2
63
 
3
64
  [![PyPI version](https://img.shields.io/pypi/v/avrotize)](https://pypi.org/project/avrotize/)
@@ -27,6 +88,22 @@ You can install Avrotize from PyPI, [having installed Python 3.10 or later](http
27
88
  pip install avrotize
28
89
  ```
29
90
 
91
+ For SQL database support (`sql2a` command), install the optional database drivers:
92
+
93
+ ```bash
94
+ # PostgreSQL
95
+ pip install avrotize[postgres]
96
+
97
+ # MySQL
98
+ pip install avrotize[mysql]
99
+
100
+ # SQL Server
101
+ pip install avrotize[sqlserver]
102
+
103
+ # All SQL databases
104
+ pip install avrotize[all-sql]
105
+ ```
106
+
30
107
  ## Usage
31
108
 
32
109
  Avrotize provides several commands for converting schema formats via Avrotize Schema.
@@ -38,6 +115,11 @@ Converting to Avrotize Schema:
38
115
  - [`avrotize x2a`](#convert-xml-schema-xsd-to-avrotize-schema) - Convert XML schema to Avrotize Schema.
39
116
  - [`avrotize asn2a`](#convert-asn1-schema-to-avrotize-schema) - Convert ASN.1 to Avrotize Schema.
40
117
  - [`avrotize k2a`](#convert-kusto-table-definition-to-avrotize-schema) - Convert Kusto table definitions to Avrotize Schema.
118
+ - [`avrotize sql2a`](#convert-sql-database-schema-to-avrotize-schema) - Convert SQL database schema to Avrotize Schema.
119
+ - [`avrotize json2a`](#infer-avro-schema-from-json-files) - Infer Avro schema from JSON files.
120
+ - [`avrotize json2s`](#infer-json-structure-schema-from-json-files) - Infer JSON Structure schema from JSON files.
121
+ - [`avrotize xml2a`](#infer-avro-schema-from-xml-files) - Infer Avro schema from XML files.
122
+ - [`avrotize xml2s`](#infer-json-structure-schema-from-xml-files) - Infer JSON Structure schema from XML files.
41
123
  - [`avrotize pq2a`](#convert-parquet-schema-to-avrotize-schema) - Convert Parquet schema to Avrotize Schema.
42
124
  - [`avrotize csv2a`](#convert-csv-file-to-avrotize-schema) - Convert CSV file to Avrotize Schema.
43
125
  - [`avrotize kstruct2a`](#convert-kafka-connect-schema-to-avrotize-schema) - Convert Kafka Connect Schema to Avrotize Schema.
@@ -105,6 +187,7 @@ Direct JSON Structure conversions:
105
187
  Other commands:
106
188
 
107
189
  - [`avrotize pcf`](#create-the-parsing-canonical-form-pcf-of-an-avrotize-schema) - Create the Parsing Canonical Form (PCF) of an Avrotize Schema.
190
+ - [`avrotize validate`](#validate-json-instances-against-schemas) - Validate JSON instances against Avro or JSON Structure schemas.
108
191
 
109
192
  JSON Structure conversions:
110
193
 
@@ -378,6 +461,150 @@ Conversion notes:
378
461
  - For `dynamic` columns, the tool will sample the data in the table to determine the structure of the dynamic column. The tool will map the dynamic column to an Avro record type with fields that correspond to the fields found in the dynamic column. If the dynamic column contains nested dynamic columns, the tool will recursively map those to Avro record types. If records with conflicting structures are found in the dynamic column, the tool will emit a union of record types for the dynamic column.
379
462
  - If the `--emit-cloudevents-xregistry` option is set, the tool will emit an [xRegistry](http://xregistry.io) registry manifest file with a CloudEvent message definition for each table in the Kusto database and a separate Avro Schema for each table in the embedded schema registry. If one or more tables are found to contain CloudEvent data (as indicated by the presence of the CloudEvents attribute columns), the tool will inspect the content of the `type` (or `__type` or `__type`) columns to determine which CloudEvent types have been stored in the table and will emit a CloudEvent definition and schema for each unique type.
380
463
 
464
+ ### Convert SQL database schema to Avrotize Schema
465
+
466
+ ```bash
467
+ avrotize sql2a --connection-string <connection_string> [--username <user>] [--password <pass>] [--dialect <dialect>] [--database <database>] [--table-name <table>] [--out <path_to_avro_schema_file>] [--namespace <namespace>] [--infer-json] [--infer-xml] [--sample-size <n>] [--emit-cloudevents] [--emit-xregistry]
468
+ ```
469
+
470
+ Parameters:
471
+
472
+ - `--connection-string`: The database connection string. Supports SSL/TLS and integrated authentication options (see examples below).
473
+ - `--username`: (optional) Database username. Overrides any username in the connection string. Use this to avoid credentials in command history.
474
+ - `--password`: (optional) Database password. Overrides any password in the connection string. Use this to avoid credentials in command history.
475
+ - `--dialect`: (optional) The SQL dialect: `postgres` (default), `mysql`, `sqlserver`, `oracle`, or `sqlite`.
476
+ - `--database`: (optional) The database name if not specified in the connection string.
477
+ - `--table-name`: (optional) A specific table to convert. If omitted, all tables are converted.
478
+ - `--out`: The path to the Avrotize Schema file. If omitted, output goes to stdout.
479
+ - `--namespace`: (optional) The Avro namespace for the generated schema.
480
+ - `--infer-json`: (optional, default: true) Infer schema for JSON/JSONB columns by sampling data.
481
+ - `--infer-xml`: (optional, default: true) Infer schema for XML columns by sampling data.
482
+ - `--sample-size`: (optional, default: 100) Number of rows to sample for JSON/XML schema inference.
483
+ - `--emit-cloudevents`: (optional) Detect CloudEvents tables and emit CloudEvents declarations.
484
+ - `--emit-xregistry`: (optional) Emit an xRegistry manifest instead of a single schema file.
485
+
486
+ Connection string examples:
487
+
488
+ ```bash
489
+ # PostgreSQL with separate credentials (preferred for security)
490
+ avrotize sql2a --connection-string "postgresql://host:5432/mydb?sslmode=require" --username myuser --password mypass --out schema.avsc
491
+
492
+ # PostgreSQL with SSL (credentials in URL)
493
+ avrotize sql2a --connection-string "postgresql://user:pass@host:5432/mydb?sslmode=require" --out schema.avsc
494
+
495
+ # MySQL with SSL
496
+ avrotize sql2a --connection-string "mysql://user:pass@host:3306/mydb?ssl=true" --dialect mysql --out schema.avsc
497
+
498
+ # SQL Server with Windows Authentication (omit user/password)
499
+ avrotize sql2a --connection-string "mssql://@host:1433/mydb" --dialect sqlserver --out schema.avsc
500
+
501
+ # SQL Server with TLS encryption
502
+ avrotize sql2a --connection-string "mssql://user:pass@host:1433/mydb?encrypt=true" --dialect sqlserver --out schema.avsc
503
+
504
+ # SQLite file
505
+ avrotize sql2a --connection-string "/path/to/database.db" --dialect sqlite --out schema.avsc
506
+ ```
507
+
508
+ Conversion notes:
509
+
510
+ - The tool connects to a live database and reads the schema from the information schema or system catalogs.
511
+ - Type mappings for each dialect:
512
+ - **PostgreSQL**: All standard types including `uuid`, `jsonb`, `xml`, arrays, and custom types.
513
+ - **MySQL**: Standard types including `json`, `enum`, `set`, and spatial types.
514
+ - **SQL Server**: Standard types including `uniqueidentifier`, `xml`, `money`, and `hierarchyid`.
515
+ - **Oracle**: Standard types including `number`, `clob`, `blob`, and Oracle-specific types.
516
+ - **SQLite**: Dynamic typing mapped based on declared type affinity.
517
+ - For JSON/JSONB columns (PostgreSQL, MySQL) and XML columns, the tool samples data to infer the structure. Fields that appear in some but not all records are folded together. If field types conflict across records, the tool emits a union of record types.
518
+ - For columns with keys that cannot be valid Avro identifiers (UUIDs, URLs, special characters), the tool generates `map<string, T>` types instead of record types.
519
+ - Table and column comments are preserved as Avro `doc` attributes where available.
520
+ - Primary key columns are noted in the schema's `unique` attribute.
521
+
522
+ ### Infer Avro schema from JSON files
523
+
524
+ ```bash
525
+ avrotize json2a <json_files...> [--out <path_to_avro_schema_file>] [--type-name <name>] [--namespace <namespace>] [--sample-size <n>]
526
+ ```
527
+
528
+ Parameters:
529
+
530
+ - `<json_files...>`: One or more JSON files to analyze. Supports JSON arrays, single objects, and JSONL (JSON Lines) format.
531
+ - `--out`: The path to the Avro schema file. If omitted, output goes to stdout.
532
+ - `--type-name`: (optional) Name for the root type (default: "Document").
533
+ - `--namespace`: (optional) Avro namespace for generated types.
534
+ - `--sample-size`: (optional) Maximum number of records to sample (0 = all, default: 0).
535
+
536
+ Example:
537
+
538
+ ```bash
539
+ # Infer schema from multiple JSON files
540
+ avrotize json2a data1.json data2.json --out schema.avsc --type-name Event --namespace com.example
541
+
542
+ # Infer schema from JSONL file
543
+ avrotize json2a events.jsonl --out events.avsc --type-name LogEntry
544
+ ```
545
+
546
+ ### Infer JSON Structure schema from JSON files
547
+
548
+ ```bash
549
+ avrotize json2s <json_files...> [--out <path_to_jstruct_schema_file>] [--type-name <name>] [--base-id <uri>] [--sample-size <n>]
550
+ ```
551
+
552
+ Parameters:
553
+
554
+ - `<json_files...>`: One or more JSON files to analyze.
555
+ - `--out`: The path to the JSON Structure schema file. If omitted, output goes to stdout.
556
+ - `--type-name`: (optional) Name for the root type (default: "Document").
557
+ - `--base-id`: (optional) Base URI for $id generation (default: "https://example.com/").
558
+ - `--sample-size`: (optional) Maximum number of records to sample (0 = all, default: 0).
559
+
560
+ Example:
561
+
562
+ ```bash
563
+ avrotize json2s data.json --out schema.jstruct.json --type-name Person --base-id https://myapi.example.com/schemas/
564
+ ```
565
+
566
+ ### Infer Avro schema from XML files
567
+
568
+ ```bash
569
+ avrotize xml2a <xml_files...> [--out <path_to_avro_schema_file>] [--type-name <name>] [--namespace <namespace>] [--sample-size <n>]
570
+ ```
571
+
572
+ Parameters:
573
+
574
+ - `<xml_files...>`: One or more XML files to analyze.
575
+ - `--out`: The path to the Avro schema file. If omitted, output goes to stdout.
576
+ - `--type-name`: (optional) Name for the root type (default: "Document").
577
+ - `--namespace`: (optional) Avro namespace for generated types.
578
+ - `--sample-size`: (optional) Maximum number of documents to sample (0 = all, default: 0).
579
+
580
+ Example:
581
+
582
+ ```bash
583
+ avrotize xml2a config.xml --out config.avsc --type-name Configuration --namespace com.example.config
584
+ ```
585
+
586
+ ### Infer JSON Structure schema from XML files
587
+
588
+ ```bash
589
+ avrotize xml2s <xml_files...> [--out <path_to_jstruct_schema_file>] [--type-name <name>] [--base-id <uri>] [--sample-size <n>]
590
+ ```
591
+
592
+ Parameters:
593
+
594
+ - `<xml_files...>`: One or more XML files to analyze.
595
+ - `--out`: The path to the JSON Structure schema file. If omitted, output goes to stdout.
596
+ - `--type-name`: (optional) Name for the root type (default: "Document").
597
+ - `--base-id`: (optional) Base URI for $id generation (default: "https://example.com/").
598
+ - `--sample-size`: (optional) Maximum number of documents to sample (0 = all, default: 0).
599
+
600
+ Conversion notes (applies to all inference commands):
601
+
602
+ - XML attributes are converted to fields prefixed with `@` (normalized to valid identifiers).
603
+ - Text content in mixed-content elements becomes a `#text` field.
604
+ - Repeated elements are inferred as arrays.
605
+ - Multiple files with different structures are merged into a unified schema.
606
+ - Sparse data (fields that appear in some but not all records) is folded into a single type.
607
+
381
608
  ### Convert Avrotize Schema to Kusto table declaration
382
609
 
383
610
  ```bash
@@ -1260,6 +1487,45 @@ Conversion notes:
1260
1487
  - The tool generates the Parsing Canonical Form (PCF) of the Avrotize Schema. The PCF is a normalized form of the schema that is used for schema comparison and compatibility checking.
1261
1488
  - The PCF is a JSON object that is written to stdout.
1262
1489
 
1490
+ ### Validate JSON instances against schemas
1491
+
1492
+ ```bash
1493
+ avrotize validate <json_files...> --schema <schema_file> [--schema-type <type>] [--quiet]
1494
+ ```
1495
+
1496
+ Parameters:
1497
+
1498
+ - `<json_files...>`: One or more JSON files to validate. Supports single JSON objects, JSON arrays, and JSONL (newline-delimited JSON) formats.
1499
+ - `--schema <schema_file>`: Path to the schema file (`.avsc` for Avro, `.jstruct.json` for JSON Structure).
1500
+ - `--schema-type`: (optional) Schema type: `avro` or `jstruct`. Auto-detected from file extension if omitted.
1501
+ - `--quiet`: (optional) Suppress output. Exit code 0 if all instances are valid, 1 if any are invalid.
1502
+
1503
+ Validation notes:
1504
+
1505
+ - Validates JSON instances against Avro schemas per the [Avrotize Schema specification](specs/avrotize-schema.md).
1506
+ - Supports all Avro primitive types: null, boolean, int, long, float, double, bytes, string.
1507
+ - Supports all Avro complex types: record, enum, array, map, fixed.
1508
+ - Supports logical types with both native and string encodings: decimal, uuid, date, time-millis, time-micros, timestamp-millis, timestamp-micros, duration.
1509
+ - Supports field `altnames` for JSON field name mapping.
1510
+ - Supports enum `altsymbols` for JSON symbol mapping.
1511
+ - For JSON Structure validation, requires the `json-structure` package.
1512
+
1513
+ Example:
1514
+
1515
+ ```bash
1516
+ # Validate JSON file against Avro schema
1517
+ avrotize validate data.json --schema schema.avsc
1518
+
1519
+ # Validate multiple files
1520
+ avrotize validate file1.json file2.json --schema schema.avsc
1521
+
1522
+ # Validate JSONL file against JSON Structure schema
1523
+ avrotize validate events.jsonl --schema events.jstruct.json
1524
+
1525
+ # Quiet mode for CI/CD pipelines (exit code only)
1526
+ avrotize validate data.json --schema schema.avsc --quiet
1527
+ ```
1528
+
1263
1529
  ### Convert JSON Structure schema to GraphQL schema
1264
1530
 
1265
1531
  ```bash
@@ -1327,3 +1593,4 @@ cat myschema.avsc | avrotize a2graphql > myschema.graphql
1327
1593
  ```
1328
1594
 
1329
1595
  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.
1596
+
@@ -1,51 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: avrotize
3
- Version: 3.0.2
4
- Summary: Tools to convert from and to Avro Schema from various other schema languages.
5
- Author-email: Clemens Vasters <clemensv@microsoft.com>
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- License-File: LICENSE
12
- Requires-Dist: jsonschema>=4.23.0
13
- Requires-Dist: lark>=1.1.9
14
- Requires-Dist: pyarrow>=22.0.0
15
- Requires-Dist: asn1tools>=0.167.0
16
- Requires-Dist: jsonpointer>=3.0.0
17
- Requires-Dist: jsonpath-ng>=1.6.1
18
- Requires-Dist: jsoncomparison>=1.1.0
19
- Requires-Dist: requests>=2.32.3
20
- Requires-Dist: azure-kusto-data>=5.0.5
21
- Requires-Dist: azure-identity>=1.17.1
22
- Requires-Dist: datapackage>=1.15.4
23
- Requires-Dist: jinja2>=3.1.4
24
- Requires-Dist: pyiceberg>=0.10.0
25
- Requires-Dist: pandas>=2.2.2
26
- Requires-Dist: docker>=7.1.0
27
- Requires-Dist: cddlparser>=0.5.0
28
- Requires-Dist: json-structure>=0.1.8
29
- Requires-Dist: pytest>=8.3.2 ; extra == "dev"
30
- Requires-Dist: fastavro>=1.9.5 ; extra == "dev"
31
- Requires-Dist: xmlschema>=3.3.2 ; extra == "dev"
32
- Requires-Dist: xmlunittest>=1.0.1 ; extra == "dev"
33
- Requires-Dist: pylint>=3.2.6 ; extra == "dev"
34
- Requires-Dist: dataclasses_json>=0.6.7 ; extra == "dev"
35
- Requires-Dist: dataclasses>=0.8 ; extra == "dev"
36
- Requires-Dist: pydantic>=2.8.2 ; extra == "dev"
37
- Requires-Dist: avro>=1.12.0 ; extra == "dev"
38
- Requires-Dist: testcontainers>=4.7.2 ; extra == "dev"
39
- Requires-Dist: pymysql>=1.1.1 ; extra == "dev"
40
- Requires-Dist: psycopg2>=2.9.9 ; extra == "dev"
41
- Requires-Dist: pyodbc>=5.1.0 ; extra == "dev"
42
- Requires-Dist: pymongo>=4.8.0 ; extra == "dev"
43
- Requires-Dist: oracledb>=2.3.0 ; extra == "dev"
44
- Requires-Dist: cassandra-driver>=3.29.1 ; extra == "dev"
45
- Requires-Dist: sqlalchemy>=2.0.32 ; extra == "dev"
46
- Requires-Dist: graphql-core>=3.2.0 ; extra == "dev"
47
- Provides-Extra: dev
48
-
49
1
  # Avrotize & Structurize
50
2
 
51
3
  [![PyPI version](https://img.shields.io/pypi/v/avrotize)](https://pypi.org/project/avrotize/)
@@ -75,6 +27,22 @@ You can install Avrotize from PyPI, [having installed Python 3.10 or later](http
75
27
  pip install avrotize
76
28
  ```
77
29
 
30
+ For SQL database support (`sql2a` command), install the optional database drivers:
31
+
32
+ ```bash
33
+ # PostgreSQL
34
+ pip install avrotize[postgres]
35
+
36
+ # MySQL
37
+ pip install avrotize[mysql]
38
+
39
+ # SQL Server
40
+ pip install avrotize[sqlserver]
41
+
42
+ # All SQL databases
43
+ pip install avrotize[all-sql]
44
+ ```
45
+
78
46
  ## Usage
79
47
 
80
48
  Avrotize provides several commands for converting schema formats via Avrotize Schema.
@@ -86,6 +54,11 @@ Converting to Avrotize Schema:
86
54
  - [`avrotize x2a`](#convert-xml-schema-xsd-to-avrotize-schema) - Convert XML schema to Avrotize Schema.
87
55
  - [`avrotize asn2a`](#convert-asn1-schema-to-avrotize-schema) - Convert ASN.1 to Avrotize Schema.
88
56
  - [`avrotize k2a`](#convert-kusto-table-definition-to-avrotize-schema) - Convert Kusto table definitions to Avrotize Schema.
57
+ - [`avrotize sql2a`](#convert-sql-database-schema-to-avrotize-schema) - Convert SQL database schema to Avrotize Schema.
58
+ - [`avrotize json2a`](#infer-avro-schema-from-json-files) - Infer Avro schema from JSON files.
59
+ - [`avrotize json2s`](#infer-json-structure-schema-from-json-files) - Infer JSON Structure schema from JSON files.
60
+ - [`avrotize xml2a`](#infer-avro-schema-from-xml-files) - Infer Avro schema from XML files.
61
+ - [`avrotize xml2s`](#infer-json-structure-schema-from-xml-files) - Infer JSON Structure schema from XML files.
89
62
  - [`avrotize pq2a`](#convert-parquet-schema-to-avrotize-schema) - Convert Parquet schema to Avrotize Schema.
90
63
  - [`avrotize csv2a`](#convert-csv-file-to-avrotize-schema) - Convert CSV file to Avrotize Schema.
91
64
  - [`avrotize kstruct2a`](#convert-kafka-connect-schema-to-avrotize-schema) - Convert Kafka Connect Schema to Avrotize Schema.
@@ -153,6 +126,7 @@ Direct JSON Structure conversions:
153
126
  Other commands:
154
127
 
155
128
  - [`avrotize pcf`](#create-the-parsing-canonical-form-pcf-of-an-avrotize-schema) - Create the Parsing Canonical Form (PCF) of an Avrotize Schema.
129
+ - [`avrotize validate`](#validate-json-instances-against-schemas) - Validate JSON instances against Avro or JSON Structure schemas.
156
130
 
157
131
  JSON Structure conversions:
158
132
 
@@ -426,6 +400,150 @@ Conversion notes:
426
400
  - For `dynamic` columns, the tool will sample the data in the table to determine the structure of the dynamic column. The tool will map the dynamic column to an Avro record type with fields that correspond to the fields found in the dynamic column. If the dynamic column contains nested dynamic columns, the tool will recursively map those to Avro record types. If records with conflicting structures are found in the dynamic column, the tool will emit a union of record types for the dynamic column.
427
401
  - If the `--emit-cloudevents-xregistry` option is set, the tool will emit an [xRegistry](http://xregistry.io) registry manifest file with a CloudEvent message definition for each table in the Kusto database and a separate Avro Schema for each table in the embedded schema registry. If one or more tables are found to contain CloudEvent data (as indicated by the presence of the CloudEvents attribute columns), the tool will inspect the content of the `type` (or `__type` or `__type`) columns to determine which CloudEvent types have been stored in the table and will emit a CloudEvent definition and schema for each unique type.
428
402
 
403
+ ### Convert SQL database schema to Avrotize Schema
404
+
405
+ ```bash
406
+ avrotize sql2a --connection-string <connection_string> [--username <user>] [--password <pass>] [--dialect <dialect>] [--database <database>] [--table-name <table>] [--out <path_to_avro_schema_file>] [--namespace <namespace>] [--infer-json] [--infer-xml] [--sample-size <n>] [--emit-cloudevents] [--emit-xregistry]
407
+ ```
408
+
409
+ Parameters:
410
+
411
+ - `--connection-string`: The database connection string. Supports SSL/TLS and integrated authentication options (see examples below).
412
+ - `--username`: (optional) Database username. Overrides any username in the connection string. Use this to avoid credentials in command history.
413
+ - `--password`: (optional) Database password. Overrides any password in the connection string. Use this to avoid credentials in command history.
414
+ - `--dialect`: (optional) The SQL dialect: `postgres` (default), `mysql`, `sqlserver`, `oracle`, or `sqlite`.
415
+ - `--database`: (optional) The database name if not specified in the connection string.
416
+ - `--table-name`: (optional) A specific table to convert. If omitted, all tables are converted.
417
+ - `--out`: The path to the Avrotize Schema file. If omitted, output goes to stdout.
418
+ - `--namespace`: (optional) The Avro namespace for the generated schema.
419
+ - `--infer-json`: (optional, default: true) Infer schema for JSON/JSONB columns by sampling data.
420
+ - `--infer-xml`: (optional, default: true) Infer schema for XML columns by sampling data.
421
+ - `--sample-size`: (optional, default: 100) Number of rows to sample for JSON/XML schema inference.
422
+ - `--emit-cloudevents`: (optional) Detect CloudEvents tables and emit CloudEvents declarations.
423
+ - `--emit-xregistry`: (optional) Emit an xRegistry manifest instead of a single schema file.
424
+
425
+ Connection string examples:
426
+
427
+ ```bash
428
+ # PostgreSQL with separate credentials (preferred for security)
429
+ avrotize sql2a --connection-string "postgresql://host:5432/mydb?sslmode=require" --username myuser --password mypass --out schema.avsc
430
+
431
+ # PostgreSQL with SSL (credentials in URL)
432
+ avrotize sql2a --connection-string "postgresql://user:pass@host:5432/mydb?sslmode=require" --out schema.avsc
433
+
434
+ # MySQL with SSL
435
+ avrotize sql2a --connection-string "mysql://user:pass@host:3306/mydb?ssl=true" --dialect mysql --out schema.avsc
436
+
437
+ # SQL Server with Windows Authentication (omit user/password)
438
+ avrotize sql2a --connection-string "mssql://@host:1433/mydb" --dialect sqlserver --out schema.avsc
439
+
440
+ # SQL Server with TLS encryption
441
+ avrotize sql2a --connection-string "mssql://user:pass@host:1433/mydb?encrypt=true" --dialect sqlserver --out schema.avsc
442
+
443
+ # SQLite file
444
+ avrotize sql2a --connection-string "/path/to/database.db" --dialect sqlite --out schema.avsc
445
+ ```
446
+
447
+ Conversion notes:
448
+
449
+ - The tool connects to a live database and reads the schema from the information schema or system catalogs.
450
+ - Type mappings for each dialect:
451
+ - **PostgreSQL**: All standard types including `uuid`, `jsonb`, `xml`, arrays, and custom types.
452
+ - **MySQL**: Standard types including `json`, `enum`, `set`, and spatial types.
453
+ - **SQL Server**: Standard types including `uniqueidentifier`, `xml`, `money`, and `hierarchyid`.
454
+ - **Oracle**: Standard types including `number`, `clob`, `blob`, and Oracle-specific types.
455
+ - **SQLite**: Dynamic typing mapped based on declared type affinity.
456
+ - For JSON/JSONB columns (PostgreSQL, MySQL) and XML columns, the tool samples data to infer the structure. Fields that appear in some but not all records are folded together. If field types conflict across records, the tool emits a union of record types.
457
+ - For columns with keys that cannot be valid Avro identifiers (UUIDs, URLs, special characters), the tool generates `map<string, T>` types instead of record types.
458
+ - Table and column comments are preserved as Avro `doc` attributes where available.
459
+ - Primary key columns are noted in the schema's `unique` attribute.
460
+
461
+ ### Infer Avro schema from JSON files
462
+
463
+ ```bash
464
+ avrotize json2a <json_files...> [--out <path_to_avro_schema_file>] [--type-name <name>] [--namespace <namespace>] [--sample-size <n>]
465
+ ```
466
+
467
+ Parameters:
468
+
469
+ - `<json_files...>`: One or more JSON files to analyze. Supports JSON arrays, single objects, and JSONL (JSON Lines) format.
470
+ - `--out`: The path to the Avro schema file. If omitted, output goes to stdout.
471
+ - `--type-name`: (optional) Name for the root type (default: "Document").
472
+ - `--namespace`: (optional) Avro namespace for generated types.
473
+ - `--sample-size`: (optional) Maximum number of records to sample (0 = all, default: 0).
474
+
475
+ Example:
476
+
477
+ ```bash
478
+ # Infer schema from multiple JSON files
479
+ avrotize json2a data1.json data2.json --out schema.avsc --type-name Event --namespace com.example
480
+
481
+ # Infer schema from JSONL file
482
+ avrotize json2a events.jsonl --out events.avsc --type-name LogEntry
483
+ ```
484
+
485
+ ### Infer JSON Structure schema from JSON files
486
+
487
+ ```bash
488
+ avrotize json2s <json_files...> [--out <path_to_jstruct_schema_file>] [--type-name <name>] [--base-id <uri>] [--sample-size <n>]
489
+ ```
490
+
491
+ Parameters:
492
+
493
+ - `<json_files...>`: One or more JSON files to analyze.
494
+ - `--out`: The path to the JSON Structure schema file. If omitted, output goes to stdout.
495
+ - `--type-name`: (optional) Name for the root type (default: "Document").
496
+ - `--base-id`: (optional) Base URI for $id generation (default: "https://example.com/").
497
+ - `--sample-size`: (optional) Maximum number of records to sample (0 = all, default: 0).
498
+
499
+ Example:
500
+
501
+ ```bash
502
+ avrotize json2s data.json --out schema.jstruct.json --type-name Person --base-id https://myapi.example.com/schemas/
503
+ ```
504
+
505
+ ### Infer Avro schema from XML files
506
+
507
+ ```bash
508
+ avrotize xml2a <xml_files...> [--out <path_to_avro_schema_file>] [--type-name <name>] [--namespace <namespace>] [--sample-size <n>]
509
+ ```
510
+
511
+ Parameters:
512
+
513
+ - `<xml_files...>`: One or more XML files to analyze.
514
+ - `--out`: The path to the Avro schema file. If omitted, output goes to stdout.
515
+ - `--type-name`: (optional) Name for the root type (default: "Document").
516
+ - `--namespace`: (optional) Avro namespace for generated types.
517
+ - `--sample-size`: (optional) Maximum number of documents to sample (0 = all, default: 0).
518
+
519
+ Example:
520
+
521
+ ```bash
522
+ avrotize xml2a config.xml --out config.avsc --type-name Configuration --namespace com.example.config
523
+ ```
524
+
525
+ ### Infer JSON Structure schema from XML files
526
+
527
+ ```bash
528
+ avrotize xml2s <xml_files...> [--out <path_to_jstruct_schema_file>] [--type-name <name>] [--base-id <uri>] [--sample-size <n>]
529
+ ```
530
+
531
+ Parameters:
532
+
533
+ - `<xml_files...>`: One or more XML files to analyze.
534
+ - `--out`: The path to the JSON Structure schema file. If omitted, output goes to stdout.
535
+ - `--type-name`: (optional) Name for the root type (default: "Document").
536
+ - `--base-id`: (optional) Base URI for $id generation (default: "https://example.com/").
537
+ - `--sample-size`: (optional) Maximum number of documents to sample (0 = all, default: 0).
538
+
539
+ Conversion notes (applies to all inference commands):
540
+
541
+ - XML attributes are converted to fields prefixed with `@` (normalized to valid identifiers).
542
+ - Text content in mixed-content elements becomes a `#text` field.
543
+ - Repeated elements are inferred as arrays.
544
+ - Multiple files with different structures are merged into a unified schema.
545
+ - Sparse data (fields that appear in some but not all records) is folded into a single type.
546
+
429
547
  ### Convert Avrotize Schema to Kusto table declaration
430
548
 
431
549
  ```bash
@@ -1308,6 +1426,45 @@ Conversion notes:
1308
1426
  - The tool generates the Parsing Canonical Form (PCF) of the Avrotize Schema. The PCF is a normalized form of the schema that is used for schema comparison and compatibility checking.
1309
1427
  - The PCF is a JSON object that is written to stdout.
1310
1428
 
1429
+ ### Validate JSON instances against schemas
1430
+
1431
+ ```bash
1432
+ avrotize validate <json_files...> --schema <schema_file> [--schema-type <type>] [--quiet]
1433
+ ```
1434
+
1435
+ Parameters:
1436
+
1437
+ - `<json_files...>`: One or more JSON files to validate. Supports single JSON objects, JSON arrays, and JSONL (newline-delimited JSON) formats.
1438
+ - `--schema <schema_file>`: Path to the schema file (`.avsc` for Avro, `.jstruct.json` for JSON Structure).
1439
+ - `--schema-type`: (optional) Schema type: `avro` or `jstruct`. Auto-detected from file extension if omitted.
1440
+ - `--quiet`: (optional) Suppress output. Exit code 0 if all instances are valid, 1 if any are invalid.
1441
+
1442
+ Validation notes:
1443
+
1444
+ - Validates JSON instances against Avro schemas per the [Avrotize Schema specification](specs/avrotize-schema.md).
1445
+ - Supports all Avro primitive types: null, boolean, int, long, float, double, bytes, string.
1446
+ - Supports all Avro complex types: record, enum, array, map, fixed.
1447
+ - Supports logical types with both native and string encodings: decimal, uuid, date, time-millis, time-micros, timestamp-millis, timestamp-micros, duration.
1448
+ - Supports field `altnames` for JSON field name mapping.
1449
+ - Supports enum `altsymbols` for JSON symbol mapping.
1450
+ - For JSON Structure validation, requires the `json-structure` package.
1451
+
1452
+ Example:
1453
+
1454
+ ```bash
1455
+ # Validate JSON file against Avro schema
1456
+ avrotize validate data.json --schema schema.avsc
1457
+
1458
+ # Validate multiple files
1459
+ avrotize validate file1.json file2.json --schema schema.avsc
1460
+
1461
+ # Validate JSONL file against JSON Structure schema
1462
+ avrotize validate events.jsonl --schema events.jstruct.json
1463
+
1464
+ # Quiet mode for CI/CD pipelines (exit code only)
1465
+ avrotize validate data.json --schema schema.avsc --quiet
1466
+ ```
1467
+
1311
1468
  ### Convert JSON Structure schema to GraphQL schema
1312
1469
 
1313
1470
  ```bash
@@ -1375,4 +1532,3 @@ cat myschema.avsc | avrotize a2graphql > myschema.graphql
1375
1532
  ```
1376
1533
 
1377
1534
  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.
1378
-
@@ -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 = '3.0.2'
32
- __version_tuple__ = version_tuple = (3, 0, 2)
31
+ __version__ = version = '3.1.1'
32
+ __version_tuple__ = version_tuple = (3, 1, 1)
33
33
 
34
- __commit_id__ = commit_id = 'g3ee5f8f67'
34
+ __commit_id__ = commit_id = 'ge20c22879'
@@ -38,6 +38,10 @@ def create_subparsers(subparsers, commands):
38
38
  kwargs['choices'] = arg['choices']
39
39
  if 'default' in arg:
40
40
  kwargs['default'] = arg['default']
41
+ # Handle dest for optional arguments only (positional args can't have dest)
42
+ arg_is_positional = not arg['name'].startswith('-')
43
+ if 'dest' in arg and not arg_is_positional:
44
+ kwargs['dest'] = arg['dest']
41
45
  if arg['type'] == 'bool':
42
46
  kwargs['action'] = 'store_true'
43
47
  del kwargs['type']
@@ -8,7 +8,7 @@ import { jsonObject, jsonMember, TypedJSON } from 'typedjson';
8
8
  {%- endif %}
9
9
  {%- endif %}
10
10
  {%- if avro_annotation %}
11
- import avro from 'avro-js';
11
+ import avro, { type Type } from 'avro-js';
12
12
  {%- endif %}
13
13
  {%- for import_type, import_path in imports.items() %}
14
14
  import { {{ import_type }} } from '{{ import_path }}';
@@ -22,7 +22,7 @@ import pako from 'pako';
22
22
  {%- endif %}
23
23
  export class {{ class_name }} {
24
24
  {%- if avro_annotation %}
25
- public static AvroType: avro.Type = avro.parse({{ avro_schema_json }});
25
+ public static AvroType: Type = avro.parse({{ avro_schema_json }});
26
26
  {%- endif %}
27
27
 
28
28
  {%- for field in fields %}