Giter VIP home page Giter VIP logo

Comments (5)

molon avatar molon commented on September 28, 2024

Another question:
If a nested field is signed with preload:false, the DefaultReadShop(ctx, &Shop{Id: in.GetId()}, db, nil) will returns without the nested field value (because the last param is nil).
Then if we provide part value of the nested field and their fieldMasks for DefaultPatchShop. The other field values of the nested field will be updated to empty, because we didn't get them with DefaultReadShop before.

from protoc-gen-gorm.

Calebjh avatar Calebjh commented on September 28, 2024

Regarding the first, FieldMasks are camel cased and expected to be camel cased here because of the code expected to populate the field masks (https://github.com/infobloxopen/atlas-app-toolkit/blob/master/gateway/field_presence.go and https://github.com/grpc-ecosystem/grpc-gateway/blob/master/runtime/fieldmask.go).
For FieldSelection, the usage of _fields is, I believe, so that the gateway won't try to auto-fill it and break if the syntax/type is "wrong". Not using camel-case there was done independently. Our documentation could still use more work.

Regarding the second question, using a nil field selection in DefaultReadFoo(ctx, &Foo{Id: in.GetId()}, db, nil) not working as expected when some fields are set to preload:false, that does seem like a tricky situation. I'm not sure of a good solution, though.

from protoc-gen-gorm.

molon avatar molon commented on September 28, 2024

@Calebjh

Thank you very much. That's what I want.

And I found the CamelCaseFieldMask just be called when PATCH with grpc-gateway.
(https://github.com/grpc-ecosystem/grpc-gateway/blob/d8ad87ee91e1062c2a6117bda0b5523e9cb949ef/protoc-gen-grpc-gateway/gengateway/template.go#L287-L294)

The atlas-gateway has a replacement with FieldMaskFromRequestBody to suitable for other HTTP medhot(PUT), but no replacement for CamelCaseFieldMask.

from protoc-gen-gorm.

molon avatar molon commented on September 28, 2024

Regarding the second question, maybe the pr will help. :
infobloxopen/atlas-app-toolkit#149

DefaultReadShop(ctx, &Shop{Id: in.GetId()}, db,
		&infoblox_api.FieldSelection{
			Fields:map[string]*infoblox_api.Field{
				"_assoc":nil,
				"_unassoc":nil,
			}
		},
	)

from protoc-gen-gorm.

saltbo avatar saltbo commented on September 28, 2024

Now, It's not CamelCase. we should use the raw key grpc-ecosystem/grpc-gateway#1049

from protoc-gen-gorm.

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.