Comments (4)
Hiii @gmather! This is indeed a real issue. Right now the check for foreign imports is really naive:
vtprotobuf/features/marshal/marshalto.go
Line 629 in 6ae7946
I need to come up with a better way to perform this check. Let me think it through.
from vtprotobuf.
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.
@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.
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)
- Uncompilable code generated for repeated groups
- Duplicated code generated for GRPC client/server HOT 1
- Panic after WKT commit: assignment to entry in nil map HOT 2
- Extensions are not encoded
- docs/feature: Nested ReturnToVTPool() HOT 4
- bug: oneof field that includes bytes field yields invalid ResetVT method
- Supporting Embedded and Nullable features from gogo proto HOT 2
- bug: Broken ResetVT generation for optional message HOT 1
- bug: grpc client methods does not use qualified idents
- feature: poolable messages paths with wildcard HOT 2
- unmarshal_unsafe feature produced code does not compile: "Cannot use intStringLen (type int) as the type IntegerType" HOT 1
- Run vtproto multiple times on different files of the same package HOT 3
- bug: IsMap not checked on message field's ReturnToVTpool
- bug: UnmarshalUnsafe panics when map values are empty strings HOT 2
- Request for New Release that Includes Well-Known Type Support HOT 4
- gRPC codec has different semantic on Unmarshal than the default one HOT 1
- v0.6.0 is creating issues in ubuntu20 HOT 2
- Offering assistance and discussing upkeep / releases for vtprotobuf HOT 8
- wrong pool unmarshal slize HOT 3
- Add optional unsafe operations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vtprotobuf.