Skip to content

Commit

Permalink
notes for #118
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed Jul 16, 2022
1 parent 38377e9 commit d6658ef
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/ast/src/encoding/proto/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,22 @@ const getProtoField = (context: ProtoParseContext, field: ProtoField) => {
let ast: any = null;
let optional = false;

if (
field.parsedType.name === 'Any' &&
field.options?.['(cosmos_proto.accepts_interface)']) {
// look for implements_interface where
// (cosmos_proto.implements_interface) === (cosmos_proto.accepts_interface)
console.log(field);
/*
normally you would lookup from the current ref however, there is no actual type of this referenced Union type name so you need to iterate through all of the types in the ref and any imports
Q: should we create a type that is the Union so we can reference it? or should we just always look for this and explode the definition in place wherever we use it?
IDEA: maybe in parser, we should add meta info when we find `cosmos_proto.implements_interface` and `cosmos_proto.accepts_interface` so it's easy to query when needed, inline on this field
*/
}

if (field.options?.['(gogoproto.nullable)']) {
optional = true;
}
Expand Down

0 comments on commit d6658ef

Please sign in to comment.