1616
1717} }{ {!
1818The argument and result types for functions on thrift services (and interactions)
19- } }{ {#service:supported_functions} }
19+ } }
20+ { {#import " common/adapter_info" as m_adapter_info } }
21+ { {#service:supported_functions} }
2022
2123
2224class { {> types/function_args_type} }(metaclass={ {> types/struct_metaclass} }):
@@ -29,7 +31,7 @@ class {{> types/function_args_type}}(metaclass={{> types/struct_metaclass}}):
2931 "{ {field:py_name} }", # python name (from @python.Name annotation)
3032 { {#field:type} }{ {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }{ {/field:type} }, # typeinfo
3133 None, # default value
32- { {> common/ adapter_info } }, # adapter info
34+ { {#partial m_adapter_info. adapter_info node= field:self } }, # adapter info
3335 { {#field:type} }{ {> types/is_primitive } }{ {/field:type} }, # field type is primitive
3436 { {field:idl_type} }, # IDL type (see BaseTypeEnum)
3537 ),
@@ -40,20 +42,21 @@ class {{> types/function_args_type}}(metaclass={{> types/struct_metaclass}}):
4042
4143class _fbthrift_{ {service:name} }_{ {function:name} }_result(metaclass={ {> types/struct_metaclass} }):
4244 _fbthrift_SPEC = (
43- { {#function:regular_response_type} }
44- { {^type:void?} }
45+ { {#let regular_response_type = (if function:oneway? null function:self.return_type.true_type)} }
46+ { {#if (and (object.notnull? regular_response_type) (not regular_response_type.void?))} }
47+ { {#regular_response_type} }
4548 _fbthrift_python_types.FieldInfo(
4649 0, # id
4750 _fbthrift_python_types.FieldQualifier.Optional, # qualifier
4851 "success", # name
4952 "success", # name
50- { {^type: primitive?} }lambda: { {/type:primitive? } }{ {> types/typeinfo } }, # typeinfo
53+ { {# if ( not regular_response_type. primitive?) } }lambda: { {/if } }{ {> types/typeinfo } }, # typeinfo
5154 None, # default value
52- { {> common/ adapter_info} }, # adapter info
55+ { {#partial m_adapter_info. adapter_info node= regular_response_type } }, # adapter info
5356 { {> types/is_primitive } }, # field type is primitive
5457 ),
55- { {/type:void? } }
56- { {/function: regular_response_type} }
58+ { {/regular_response_type } }
59+ { {/if ( and (object.notnull? regular_response_type) ( not regular_response_type.void?)) } }
5760 { {#function:exceptions} }
5861 _fbthrift_python_types.FieldInfo(
5962 { {field:id} }, # id
@@ -62,7 +65,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result(metaclass={{> types/st
6265 "{ {> fields/exception_field_name} }", # python name (from @python.Name annotation)
6366 { {#field:type} }{ {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }{ {/field:type} }, # typeinfo
6467 None, # default value
65- { {> common/ adapter_info } }, # adapter info
68+ { {#partial m_adapter_info. adapter_info node= field:self } }, # adapter info
6669 { {#field:type} }{ {> types/is_primitive } }{ {/field:type} }, # field type is primitive
6770 { {field:idl_type} }, # IDL type (see BaseTypeEnum)
6871 ),
@@ -83,7 +86,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result_stream_elem(metaclass=
8386 "success", # name
8487 { {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }, # typeinfo
8588 None, # default value
86- { {> common/ adapter_info} }, # adapter info
89+ { {#partial m_adapter_info. adapter_info node= type:self } }, # adapter info
8790 { {> types/is_primitive } }, # field type is primitive
8891 ),
8992 { {/function:stream_elem_type} }
@@ -95,7 +98,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result_stream_elem(metaclass=
9598 "{ {> fields/exception_field_name} }", # python name (from @python.Name annotation)
9699 { {#field:type} }{ {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }{ {/field:type} }, # typeinfo
97100 None, # default value
98- { {> common/ adapter_info } }, # adapter info
101+ { {#partial m_adapter_info. adapter_info node= field:self } }, # adapter info
99102 { {#field:type} }{ {> types/is_primitive } }{ {/field:type} }, # field type is primitive
100103 { {field:idl_type} }, # IDL type (see BaseTypeEnum)
101104 ),
@@ -116,7 +119,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result_sink_elem(metaclass={{
116119 "success", # name
117120 { {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }, # typeinfo
118121 None, # default value
119- { {> common/ adapter_info} }, # adapter info
122+ { {#partial m_adapter_info. adapter_info node= type:self } }, # adapter info
120123 { {> types/is_primitive } }, # field type is primitive
121124 ),
122125 { {/function:sink_elem_type} }
@@ -128,7 +131,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result_sink_elem(metaclass={{
128131 "{ {> fields/exception_field_name} }", # python name (from @python.Name annotation)
129132 { {#field:type} }{ {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }{ {/field:type} }, # typeinfo
130133 None, # default value
131- { {> common/ adapter_info } }, # adapter info
134+ { {#partial m_adapter_info. adapter_info node= field:self } }, # adapter info
132135 { {#field:type} }{ {> types/is_primitive } }{ {/field:type} }, # field type is primitive
133136 { {field:idl_type} }, # IDL type (see BaseTypeEnum)
134137 ),
@@ -172,7 +175,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result_sink_final(metaclass={
172175 "success", # name
173176 { {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }, # typeinfo
174177 None, # default value
175- { {> common/ adapter_info} }, # adapter info
178+ { {#partial m_adapter_info. adapter_info node= type:self } }, # adapter info
176179 { {> types/is_primitive } }, # field type is primitive
177180 ),
178181 { {/function:sink_final_response_type} }
@@ -184,7 +187,7 @@ class _fbthrift_{{service:name}}_{{function:name}}_result_sink_final(metaclass={
184187 "{ {> fields/exception_field_name} }", # python name (from @python.Name annotation)
185188 { {#field:type} }{ {^type:primitive?} }lambda: { {/type:primitive?} }{ {> types/typeinfo } }{ {/field:type} }, # typeinfo
186189 None, # default value
187- { {> common/ adapter_info } }, # adapter info
190+ { {#partial m_adapter_info. adapter_info node= field:self } }, # adapter info
188191 { {#field:type} }{ {> types/is_primitive } }{ {/field:type} }, # field type is primitive
189192 { {field:idl_type} }, # IDL type (see BaseTypeEnum)
190193 ),
0 commit comments