Open
Conversation
- Add comprehensive Solidity reserved keywords detection and mangling - Implement automatic field name mangling with _field suffix for conflicts - Fix boolean parameter parsing to support flag-style options (gen_runtime=true) - Update parameter processing to handle both boolean flags and value parameters - Add file path normalization for cross-platform compatibility - Update documentation with Solidity compatibility features
- Implement automatic detection of circular dependencies in buf/validate types - Add CIRCULAR_DEPENDENCY_MAP for FieldRules, MapRules, and RepeatedRules - Use bytes fields with encode/decode helpers to break circular references - Apply field name mangling consistently across encoder/decoder/struct generation - Add comprehensive circular dependency handling in gen_decoder.py - Add struct generation support for circular fields with descriptive comments - Update encoder to handle circular dependencies as simple byte assignments - Extend runtime type mappings to support float/double validation constraints - Update documentation with circular dependency resolution examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: add circular dependency resolution for validation schemas
Summary
Changes
Automatic Circular Dependency Detection
CIRCULAR_DEPENDENCY_MAPfor FieldRules ↔ MapRules ↔ RepeatedRules relationshipsis_circular_dependency()andshould_use_bytes_for_field()functionsBytes Field Solution
bytesrepresentation with descriptive commentsIntegration Across Generation Pipeline
Technical Details
Files Modified:
protobuf-solidity/src/protoc/plugin/gen_util.py- Added circular dependency detection logicprotobuf-solidity/src/protoc/plugin/gen_decoder.py- Updated to use bytes decoder for circular fieldsprotobuf-solidity/src/protoc/plugin/gen_encoder.py- Updated to handle circular fields as bytesprotobuf-solidity/src/protoc/plugin/gen_sol.py- Updated struct generation with circular field handlingREADME.md- Added Circular Dependency Resolution documentation sectionKey Functions Added:
is_circular_dependency(msg, field)- Detects circular referencesshould_use_bytes_for_field(msg, field)- Determines if bytes conversion neededCircular Dependencies Resolved:
Example Output
Test Plan
Dependencies
This PR builds on
feat/solidity-compatibilityfor the field name mangling functionality used throughout the circular dependency resolution system.Impact
Enables buf/validate and other validation schemas with circular dependencies to work seamlessly with the Solidity protobuf generator, expanding the plugin's capability to handle complex validation scenarios.