cli icon indicating copy to clipboard operation
cli copied to clipboard

Scaffolder: Prevent having pointer field for a type that has a custom type fields

Open lumtis opened this issue 4 years ago • 3 comments

When scaffolding a type with a custom type field:

starport s type foo
starport s map bar foo:Foo 

The foo field will be a pointer. We should use the [(gogoproto.nullable) = false] option in proto field to avoid having a pointer

Generating

message Bar {
  string index = 1; 
  Foo foo = 2 [(gogoproto.nullable) = false];
}

lumtis avatar Sep 24 '21 14:09 lumtis

Same goes for scaffolding queries:

ignite s type comment body
ignite s query show-blog id --response comments:Comment 
// Currently:
message QueryShowBlogResponse {
  Comment comments = 1;
}
// Should be:
message QueryShowBlogResponse {
  Comment comments = 1 [(gogoproto.nullable) = false];
}

fadeev avatar Dec 26 '22 14:12 fadeev

@aljo242 I propose we bump the priority of this issue. It should be reasonably straightforward to fix, and will significantly improve the scaffolding experience.

fadeev avatar Dec 26 '22 14:12 fadeev