Fix parameters missing from services (#381)
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							bc13e7070d
						
					
				
				
					commit
					3fd5a0d662
				
			| @@ -15,13 +15,14 @@ from typing import {% for i in output_file.typing_imports|sort %}{{ i }}{% if no | ||||
| {% endif %} | ||||
|  | ||||
| import betterproto | ||||
| {% if output_file.services %} | ||||
| from betterproto.grpc.grpclib_server import ServiceBase | ||||
| import grpclib | ||||
| {% endif %} | ||||
|  | ||||
| {% for i in output_file.imports|sort %} | ||||
| {{ i }} | ||||
| {% endfor %} | ||||
| {% if output_file.services %} | ||||
| import grpclib | ||||
| {% endif %} | ||||
|  | ||||
| {% if output_file.imports_type_checking_only %} | ||||
| from typing import TYPE_CHECKING | ||||
| @@ -96,9 +97,11 @@ class {{ service.py_name }}Stub(betterproto.ServiceStub): | ||||
|             {# Client streaming: need a request iterator instead #} | ||||
|             , {{ method.py_input_message_param }}_iterator: Union[AsyncIterable["{{ method.py_input_message_type }}"], Iterable["{{ method.py_input_message_type }}"]] | ||||
|         {%- endif -%} | ||||
|             , | ||||
|             * | ||||
|             , timeout: Optional[float] = None | ||||
|             , deadline: Optional["Deadline"] = None | ||||
|             , metadata: Optional["_MetadataLike"] = None | ||||
|             , metadata: Optional["MetadataLike"] = None | ||||
|             ) -> {% if method.server_streaming %}AsyncIterator["{{ method.py_output_message_type }}"]{% else %}"{{ method.py_output_message_type }}"{% endif %}: | ||||
|         {% if method.comment %} | ||||
| {{ method.comment }} | ||||
| @@ -179,7 +182,7 @@ class {{ service.py_name }}Base(ServiceBase): | ||||
|     {% endfor %} | ||||
|  | ||||
|     {% for method in service.methods %} | ||||
|     async def __rpc_{{ method.py_name }}(self, stream: grpclib.server.Stream) -> None: | ||||
|     async def __rpc_{{ method.py_name }}(self, stream: "grpclib.server.Stream[{{ method.py_input_message_type }}, {{ method.py_output_message_type }}]") -> None: | ||||
|         {% if not method.client_streaming %} | ||||
|         request = await stream.recv_message() | ||||
|         {% else %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user