Giter Site home page Giter Site logo

Comments (4)

vmg avatar vmg commented on July 1, 2024 1

Hiii @gmather! This is indeed a real issue. Right now the check for foreign imports is really naive:

foreign := strings.HasPrefix(string(message.Desc.FullName()), "google.protobuf.")

I need to come up with a better way to perform this check. Let me think it through.

from vtprotobuf.

elvizlai avatar elvizlai commented on July 1, 2024

The related issue:
x.proto

syntax = "proto3";

package api.common;

option go_package          = "api/common";

import public "google/api/field_behavior.proto";
import public "google/api/httpbody.proto";
import public "google/protobuf/any.proto";
import public "google/protobuf/empty.proto";
import public "google/protobuf/field_mask.proto";
import public "google/protobuf/struct.proto";
import public "google/protobuf/timestamp.proto";
import public "google/protobuf/wrappers.proto";

message X {
}

The generated code has error: v.SizeVT undefined (type *structpb.Value has no field or method SizeVT)

from vtprotobuf.

alexism avatar alexism commented on July 1, 2024

@vmg
I ran into that issue as well.
For the "foreign" test, instead of relying on the message full name, could we instead test the interfaces implemented by the messages? Similarly to what the gRPC codec does.

The test would be performed before invoking any *VT functions.

For example, for the "unmarshal" feature, the generated code could be something like:

			if o, ok := interface{}(m.MY_FIELD).(interface{
				UnmarshalVT([]byte) error
			});ok{
				if err := o.UnmarshalVT(dAtA[iNdEx:postIndex]); err != nil {
					return err
				}
			}else{
				if err := proto.Unmarshal(dAtA[iNdEx:postIndex], m.MY_FIELD); err!=nil{
					return err
				}
			}

from vtprotobuf.

vmg avatar vmg commented on July 1, 2024

I like that suggestion! I've implemented it in #7 -- can you guys give this a go and see if it works in your codebases?

from vtprotobuf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.