-
Couldn't load subscription status.
- Fork 222
Add support for generating protobuf3 definition #166 #1085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The commit introduces Protocol Buffer 3 (protobuf3) support for Malli schemas: - Implement transform function to convert Malli schemas to protobuf3 - Add transform-schema function for handling nested structures - Add support for enum types in Malli schemas - Add comprehensive test suite for transform and transform-schema functions - Include tests for deeply nested structures and complex schemas - Ensure generated protobuf3 definitions are syntactically correct
- Maintain same input/output interface for compatibility - Eliminate mutable state from the collect-definitions function, making it a pure function
malli.perf.core/serve! uses clj-async-profiler/serve-files which is a depcrecated function Updated the code to use clj-async-profiler/serve-ui clojure-goes-fast/clj-async-profiler@733ae1e clj-async-profiler version was updated here, metosin@9d705eb
User cherry-none fn instead of cherry in * case
|
Hi, and thanks for the PR! Quick comments:
I think the solution could look much like the JSON Schema transformation:
what do you think? |
|
Makes sense. I'll address these comments. |
|
for perf testing, most of the time goes in constructing the schema. It can be cached to check the actual transformation code perf. So: (def schema
(m/schema
[:map
[:id string?]
[:metadata [:map
[:created_at inst?]
[:tags [:vector string?]]]]
[:data [:vector [:map
[:name string?]
[:details [:map
[:type [:enum :type-a :type-b :type-c]]
[:properties [:vector [:map
[:key string?]
[:value [:or string? int? boolean?]]
[:nested [:vector [:map
[:sub_key string?]
[:sub_value any?]]]]]]]]]]]]]))
(defn transform-perf []
;; 28.656211 µs -> 640ns
(p/bench (protobuf/transform schema))) |
|
That's a good catch! I'll fix the perf namespace as well. |
|
Any update on this? |
|
+1 to this. Useful for working with Google Gemini and Vertex API. |
Closes #166
Contribution checklist
./bin/kaocha and ./bin/nodemalli.perf.core/quick-benchonmalli.protobuf3-schema/transformwith a fairly complex schema takes 28.656211 µsOverview of change