python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

Struct, Value well know type not supported

Open lizelive opened this issue 3 years ago • 1 comments

https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/struct

These should map to dict[str, any] and any

lizelive avatar Feb 03 '22 06:02 lizelive

https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto

lizelive avatar Feb 03 '22 06:02 lizelive

Hello everybody. I have the same issues when i compile the dataclass. Can you give me some advice to fix it?) I would be very grateful if you are able to help me

my proto file:

syntax = "proto3";

import "google/protobuf/struct.proto";

message Base {
  google.protobuf.Struct data = 1;
}

output file, after compile:

# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: base.proto
# plugin: python-betterproto
from dataclasses import dataclass

import betterproto

from .google import protobuf  # Wrong import <----------- Error here


@dataclass
class Base(betterproto.Message):
    data: protobuf.Struct = betterproto.message_field(1)

Lucky3337 avatar Mar 03 '23 17:03 Lucky3337

I believe #551 should fix this.

woodruffw avatar Dec 27 '23 22:12 woodruffw