Comments (6)
I'll take a look within the next few days
from fieldmask-utils.
A PR is welcomed!
from fieldmask-utils.
@mennanov any chances you can take a look at this?
from fieldmask-utils.
I wrote a similar test that passes:
func TestTitleBug(t *testing.T) {
mask := &fieldmaskpb.FieldMask{Paths: []string{"title"}}
mask.Normalize()
task := &testproto.Task{
Title: "test",
}
require.True(t, mask.IsValid(task))
protoMask, err := fieldmask_utils.MaskFromProtoFieldMask(mask, func(s string) string { return generator.CamelCase(s) })
require.Nil(t, err)
m := make(map[string]any)
err = fieldmask_utils.StructToMap(protoMask, task, m)
require.Nil(t, err)
assert.Equal(t, map[string]any{"Title": "test"}, m)
}
Try using generator.CamelCase(s)
which converts a lower case field name (in the field mask) into a camel case (golang struct naming).
from fieldmask-utils.
Thanks for the information, will give it a try! We should probably add this test case as it would help future devs that find this issue.
I can take care of creating a PR for this test and adding some docs about the generator
package (which I was completely unaware of).
from fieldmask-utils.
Resolved in PR #42
from fieldmask-utils.
Related Issues (19)
- Preserve field values in dst HOT 3
- question: any way to conver Mask to MaskInverse? HOT 3
- Question: Is there a way to validate Mask fields are correct? HOT 1
- protobuf v1.3.5 support HOT 3
- Error introduced upgrading to bazel_rules_go HOT 2
- Unexpected copy results when mask is empty HOT 1
- Example using oneof fields and StructToStruct HOT 7
- Not copying anypb correctly? HOT 1
- CamelCase func in docs is now deprecated HOT 1
- nil slice in src not working HOT 1
- not support time.Time HOT 5
- empty slice HOT 1
- feat: support protobuf wrapper values for get the value directly. HOT 1
- *int64 panic HOT 3
- Why not support mapToStruct? HOT 1
- What I set is NOT what I get ??? HOT 2
- whether add Option SrcTag() for copy from src tag HOT 2
- question: Is it possible to map from a struct to an identical struct with pointer fields? HOT 1
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 fieldmask-utils.