Changes message initialization (`__post_init__`) so that default values are no longer eagerly created to prevent infinite recursion when initializing recursive messages. As a result, `PLACEHOLDER` will be present in the message for any uninitialized fields. So, an implementation of `__get_attribute__` is added that checks for `PLACEHOLDER` and lazily creates and stores default field values. And, because `PLACEHOLDER` values don't compare equal with zero values, a custom implementation of `__eq__` is provided, and the code generation template is updated so that messages generate with `@dataclass(eq=False)`. Also add new Message __repr__ implementation that skips PLACEHOLDER values and orders keys by number from the proto. Co-authored-by: Christopher Chambers <chris@peanutcode.com> Co-authored-by: nat <n@natn.me> Co-authored-by: James <50501825+Gobot1234@users.noreply.github.com>
		
			
				
	
	
		
			13 lines
		
	
	
		
			156 B
		
	
	
	
		
			JSON
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			156 B
		
	
	
	
		
			JSON
		
	
	
	
	
	
| {
 | |
|   "name": "Zues",
 | |
|   "child": {
 | |
|     "name": "Hercules"
 | |
|   },
 | |
|   "intermediate": {
 | |
|     "child": {
 | |
|       "name": "Douglas Adams"
 | |
|     },
 | |
|     "number": 42
 | |
|   }
 | |
| }
 |