this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lexgen: handle 'ref' as procedure input type

+11 -4
+9 -2
lex/gen.go
··· 232 232 case "record": 233 233 return nil 234 234 case "query": 235 - return ts.WriteRPC(w, typename) 235 + return ts.WriteRPC(w, typename, fmt.Sprintf("%s_Input", typename)) 236 236 case "procedure": 237 - return ts.WriteRPC(w, typename) 237 + if ts.Input == nil || ts.Input.Schema == nil || ts.Input.Schema.Type == "object" { 238 + return ts.WriteRPC(w, typename, fmt.Sprintf("%s_Input", typename)) 239 + } else if ts.Input.Schema.Type == "ref" { 240 + inputname, _ := ts.namesFromRef(ts.Input.Schema.Ref) 241 + return ts.WriteRPC(w, typename, inputname) 242 + } else { 243 + return fmt.Errorf("unhandled input type: %s", ts.Input.Schema.Type) 244 + } 238 245 case "object", "string": 239 246 return nil 240 247 case "subscription":
+2 -2
lex/type_schema.go
··· 50 50 Maximum any `json:"maximum"` 51 51 } 52 52 53 - func (s *TypeSchema) WriteRPC(w io.Writer, typename string) error { 53 + func (s *TypeSchema) WriteRPC(w io.Writer, typename, inputname string) error { 54 54 pf := printerf(w) 55 55 fname := typename 56 56 ··· 65 65 case EncodingCBOR, EncodingCAR, EncodingANY, EncodingMP4: 66 66 params = fmt.Sprintf("%s, input io.Reader", params) 67 67 case EncodingJSON: 68 - params = fmt.Sprintf("%s, input *%s_Input", params, fname) 68 + params = fmt.Sprintf("%s, input *%s", params, inputname) 69 69 70 70 default: 71 71 return fmt.Errorf("unsupported input encoding (RPC input): %q", s.Input.Encoding)