Server Test Python

Server Test Python

rev. 1d902e1fdfff69f8aafe42b2306fa317ef96d562 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/__init__.pyi

@@ -1,0 +273,0 @@
    1         -
import json_rpc10.input
    2         -
import json_rpc10.middleware
    3         -
import json_rpc10.output
    4         -
import json_rpc10.tls
    5         -
import typing
    6         -
    7         -
Ctx = typing.TypeVar('Ctx')
    8         -
    9         -
class App(typing.Generic[Ctx]):
   10         -
    """
   11         -
    Main Python application, used to register operations and context and start multiple
   12         -
    workers on the same shared socket.
   13         -
   14         -
    Operations can be registered using the application object as a decorator (`@app.operation_name`).
   15         -
   16         -
    Here's a full example to get you started:
   17         -
   18         -
    ```python
   19         -
    from json_rpc10 import input
   20         -
    from json_rpc10 import output
   21         -
    from json_rpc10 import error
   22         -
    from json_rpc10 import middleware
   23         -
    from json_rpc10 import App
   24         -
   25         -
    @dataclass
   26         -
    class Context:
   27         -
        counter: int = 0
   28         -
   29         -
    app = App()
   30         -
    app.context(Context())
   31         -
   32         -
    @app.request_middleware
   33         -
    def request_middleware(request: middleware::Request):
   34         -
        if request.get_header("x-amzn-id") != "secret":
   35         -
            raise middleware.MiddlewareException("Unsupported `x-amz-id` header", 401)
   36         -
   37         -
    # The example tests how servers must support requests
   38         -
    # containing a `Content-Type` header with parameters.
   39         -
    @app.content_type_parameters
   40         -
    def content_type_parameters(input: input::ContentTypeParametersInput, ctx: Context) -> output::ContentTypeParametersOutput:
   41         -
        raise NotImplementedError
   42         -
   43         -
    # The example tests how requests and responses are serialized when there's
   44         -
    # no request or response payload because the operation has an empty input
   45         -
    # and empty output structure that reuses the same shape. While this should
   46         -
    # be rare, code generators must support this.
   47         -
    @app.empty_input_and_empty_output
   48         -
    def empty_input_and_empty_output(input: input::EmptyInputAndEmptyOutputInput, ctx: Context) -> output::EmptyInputAndEmptyOutputOutput:
   49         -
        raise NotImplementedError
   50         -
   51         -
    @app.endpoint_operation
   52         -
    def endpoint_operation(input: input::EndpointOperationInput, ctx: Context) -> output::EndpointOperationOutput:
   53         -
        raise NotImplementedError
   54         -
   55         -
    @app.endpoint_with_host_label_operation
   56         -
    def endpoint_with_host_label_operation(input: input::EndpointWithHostLabelOperationInput, ctx: Context) -> output::EndpointWithHostLabelOperationOutput:
   57         -
        raise NotImplementedError
   58         -
   59         -
    # This operation has three possible return values:
   60         -
    #
   61         -
    # 1. A successful response in the form of GreetingWithErrorsOutput
   62         -
    # 2. An InvalidGreeting error.
   63         -
    # 3. A ComplexError error.
   64         -
    #
   65         -
    # Implementations must be able to successfully take a response and
   66         -
    # properly deserialize successful and error responses.
   67         -
    @app.greeting_with_errors
   68         -
    def greeting_with_errors(input: input::GreetingWithErrorsInput, ctx: Context) -> output::GreetingWithErrorsOutput:
   69         -
        raise NotImplementedError
   70         -
   71         -
    @app.host_with_path_operation
   72         -
    def host_with_path_operation(input: input::HostWithPathOperationInput, ctx: Context) -> output::HostWithPathOperationOutput:
   73         -
        raise NotImplementedError
   74         -
   75         -
    # This operation uses unions for inputs and outputs.
   76         -
    @app.json_unions
   77         -
    def json_unions(input: input::JsonUnionsInput, ctx: Context) -> output::JsonUnionsOutput:
   78         -
        raise NotImplementedError
   79         -
   80         -
    # The example tests how requests and responses are serialized when there's
   81         -
    # no request or response payload because the operation has no input or output.
   82         -
    # While this should be rare, code generators must support this.
   83         -
    @app.no_input_and_no_output
   84         -
    def no_input_and_no_output(input: input::NoInputAndNoOutputInput, ctx: Context) -> output::NoInputAndNoOutputOutput:
   85         -
        raise NotImplementedError
   86         -
   87         -
    # The example tests how requests and responses are serialized when there's
   88         -
    # no request or response payload because the operation has no input and the
   89         -
    # output is empty. While this should be rare, code generators must support
   90         -
    # this.
   91         -
    @app.no_input_and_output
   92         -
    def no_input_and_output(input: input::NoInputAndOutputInput, ctx: Context) -> output::NoInputAndOutputOutput:
   93         -
        raise NotImplementedError
   94         -
   95         -
    @app.operation_with_defaults
   96         -
    def operation_with_defaults(input: input::OperationWithDefaultsInput, ctx: Context) -> output::OperationWithDefaultsOutput:
   97         -
        raise NotImplementedError
   98         -
   99         -
    @app.operation_with_nested_structure
  100         -
    def operation_with_nested_structure(input: input::OperationWithNestedStructureInput, ctx: Context) -> output::OperationWithNestedStructureOutput:
  101         -
        raise NotImplementedError
  102         -
  103         -
    @app.operation_with_required_members
  104         -
    def operation_with_required_members(input: input::OperationWithRequiredMembersInput, ctx: Context) -> output::OperationWithRequiredMembersOutput:
  105         -
        raise NotImplementedError
  106         -
  107         -
    @app.put_with_content_encoding
  108         -
    def put_with_content_encoding(input: input::PutWithContentEncodingInput, ctx: Context) -> output::PutWithContentEncodingOutput:
  109         -
        raise NotImplementedError
  110         -
  111         -
    @app.simple_scalar_properties
  112         -
    def simple_scalar_properties(input: input::SimpleScalarPropertiesInput, ctx: Context) -> output::SimpleScalarPropertiesOutput:
  113         -
        raise NotImplementedError
  114         -
  115         -
    app.run()
  116         -
    ```
  117         -
  118         -
    Any of operations above can be written as well prepending the `async` keyword and
  119         -
    the Python application will automatically handle it and schedule it on the event loop for you.
  120         -
    """
  121         -
  122         -
    def content_type_parameters(self, func: typing.Union[typing.Callable[[json_rpc10.input.ContentTypeParametersInput, Ctx], typing.Union[json_rpc10.output.ContentTypeParametersOutput, typing.Awaitable[json_rpc10.output.ContentTypeParametersOutput]]], typing.Callable[[json_rpc10.input.ContentTypeParametersInput], typing.Union[json_rpc10.output.ContentTypeParametersOutput, typing.Awaitable[json_rpc10.output.ContentTypeParametersOutput]]]]) -> None:
  123         -
        """
  124         -
        Method to register `content_type_parameters` Python implementation inside the handlers map.
  125         -
        It can be used as a function decorator in Python.
  126         -
        """
  127         -
        ...
  128         -
  129         -
  130         -
    def context(self, context: Ctx) -> None:
  131         -
        """
  132         -
        Register a context object that will be shared between handlers.
  133         -
        """
  134         -
        ...
  135         -
  136         -
  137         -
    def empty_input_and_empty_output(self, func: typing.Union[typing.Callable[[json_rpc10.input.EmptyInputAndEmptyOutputInput, Ctx], typing.Union[json_rpc10.output.EmptyInputAndEmptyOutputOutput, typing.Awaitable[json_rpc10.output.EmptyInputAndEmptyOutputOutput]]], typing.Callable[[json_rpc10.input.EmptyInputAndEmptyOutputInput], typing.Union[json_rpc10.output.EmptyInputAndEmptyOutputOutput, typing.Awaitable[json_rpc10.output.EmptyInputAndEmptyOutputOutput]]]]) -> None:
  138         -
        """
  139         -
        Method to register `empty_input_and_empty_output` Python implementation inside the handlers map.
  140         -
        It can be used as a function decorator in Python.
  141         -
        """
  142         -
        ...
  143         -
  144         -
  145         -
    def endpoint_operation(self, func: typing.Union[typing.Callable[[json_rpc10.input.EndpointOperationInput, Ctx], typing.Union[json_rpc10.output.EndpointOperationOutput, typing.Awaitable[json_rpc10.output.EndpointOperationOutput]]], typing.Callable[[json_rpc10.input.EndpointOperationInput], typing.Union[json_rpc10.output.EndpointOperationOutput, typing.Awaitable[json_rpc10.output.EndpointOperationOutput]]]]) -> None:
  146         -
        """
  147         -
        Method to register `endpoint_operation` Python implementation inside the handlers map.
  148         -
        It can be used as a function decorator in Python.
  149         -
        """
  150         -
        ...
  151         -
  152         -
  153         -
    def endpoint_with_host_label_operation(self, func: typing.Union[typing.Callable[[json_rpc10.input.EndpointWithHostLabelOperationInput, Ctx], typing.Union[json_rpc10.output.EndpointWithHostLabelOperationOutput, typing.Awaitable[json_rpc10.output.EndpointWithHostLabelOperationOutput]]], typing.Callable[[json_rpc10.input.EndpointWithHostLabelOperationInput], typing.Union[json_rpc10.output.EndpointWithHostLabelOperationOutput, typing.Awaitable[json_rpc10.output.EndpointWithHostLabelOperationOutput]]]]) -> None:
  154         -
        """
  155         -
        Method to register `endpoint_with_host_label_operation` Python implementation inside the handlers map.
  156         -
        It can be used as a function decorator in Python.
  157         -
        """
  158         -
        ...
  159         -
  160         -
  161         -
    def greeting_with_errors(self, func: typing.Union[typing.Callable[[json_rpc10.input.GreetingWithErrorsInput, Ctx], typing.Union[json_rpc10.output.GreetingWithErrorsOutput, typing.Awaitable[json_rpc10.output.GreetingWithErrorsOutput]]], typing.Callable[[json_rpc10.input.GreetingWithErrorsInput], typing.Union[json_rpc10.output.GreetingWithErrorsOutput, typing.Awaitable[json_rpc10.output.GreetingWithErrorsOutput]]]]) -> None:
  162         -
        """
  163         -
        Method to register `greeting_with_errors` Python implementation inside the handlers map.
  164         -
        It can be used as a function decorator in Python.
  165         -
        """
  166         -
        ...
  167         -
  168         -
  169         -
    def host_with_path_operation(self, func: typing.Union[typing.Callable[[json_rpc10.input.HostWithPathOperationInput, Ctx], typing.Union[json_rpc10.output.HostWithPathOperationOutput, typing.Awaitable[json_rpc10.output.HostWithPathOperationOutput]]], typing.Callable[[json_rpc10.input.HostWithPathOperationInput], typing.Union[json_rpc10.output.HostWithPathOperationOutput, typing.Awaitable[json_rpc10.output.HostWithPathOperationOutput]]]]) -> None:
  170         -
        """
  171         -
        Method to register `host_with_path_operation` Python implementation inside the handlers map.
  172         -
        It can be used as a function decorator in Python.
  173         -
        """
  174         -
        ...
  175         -
  176         -
  177         -
    def json_unions(self, func: typing.Union[typing.Callable[[json_rpc10.input.JsonUnionsInput, Ctx], typing.Union[json_rpc10.output.JsonUnionsOutput, typing.Awaitable[json_rpc10.output.JsonUnionsOutput]]], typing.Callable[[json_rpc10.input.JsonUnionsInput], typing.Union[json_rpc10.output.JsonUnionsOutput, typing.Awaitable[json_rpc10.output.JsonUnionsOutput]]]]) -> None:
  178         -
        """
  179         -
        Method to register `json_unions` Python implementation inside the handlers map.
  180         -
        It can be used as a function decorator in Python.
  181         -
        """
  182         -
        ...
  183         -
  184         -
  185         -
    def middleware(self, func: typing.Callable[[json_rpc10.middleware.Request, typing.Callable[[json_rpc10.middleware.Request], typing.Awaitable[json_rpc10.middleware.Response]]], typing.Awaitable[json_rpc10.middleware.Response]]) -> None:
  186         -
        """
  187         -
        Register a Python function to be executed inside a Tower middleware layer.
  188         -
        """
  189         -
        ...
  190         -
  191         -
  192         -
    def no_input_and_no_output(self, func: typing.Union[typing.Callable[[json_rpc10.input.NoInputAndNoOutputInput, Ctx], typing.Union[json_rpc10.output.NoInputAndNoOutputOutput, typing.Awaitable[json_rpc10.output.NoInputAndNoOutputOutput]]], typing.Callable[[json_rpc10.input.NoInputAndNoOutputInput], typing.Union[json_rpc10.output.NoInputAndNoOutputOutput, typing.Awaitable[json_rpc10.output.NoInputAndNoOutputOutput]]]]) -> None:
  193         -
        """
  194         -
        Method to register `no_input_and_no_output` Python implementation inside the handlers map.
  195         -
        It can be used as a function decorator in Python.
  196         -
        """
  197         -
        ...
  198         -
  199         -
  200         -
    def no_input_and_output(self, func: typing.Union[typing.Callable[[json_rpc10.input.NoInputAndOutputInput, Ctx], typing.Union[json_rpc10.output.NoInputAndOutputOutput, typing.Awaitable[json_rpc10.output.NoInputAndOutputOutput]]], typing.Callable[[json_rpc10.input.NoInputAndOutputInput], typing.Union[json_rpc10.output.NoInputAndOutputOutput, typing.Awaitable[json_rpc10.output.NoInputAndOutputOutput]]]]) -> None:
  201         -
        """
  202         -
        Method to register `no_input_and_output` Python implementation inside the handlers map.
  203         -
        It can be used as a function decorator in Python.
  204         -
        """
  205         -
        ...
  206         -
  207         -
  208         -
    def operation_with_defaults(self, func: typing.Union[typing.Callable[[json_rpc10.input.OperationWithDefaultsInput, Ctx], typing.Union[json_rpc10.output.OperationWithDefaultsOutput, typing.Awaitable[json_rpc10.output.OperationWithDefaultsOutput]]], typing.Callable[[json_rpc10.input.OperationWithDefaultsInput], typing.Union[json_rpc10.output.OperationWithDefaultsOutput, typing.Awaitable[json_rpc10.output.OperationWithDefaultsOutput]]]]) -> None:
  209         -
        """
  210         -
        Method to register `operation_with_defaults` Python implementation inside the handlers map.
  211         -
        It can be used as a function decorator in Python.
  212         -
        """
  213         -
        ...
  214         -
  215         -
  216         -
    def operation_with_nested_structure(self, func: typing.Union[typing.Callable[[json_rpc10.input.OperationWithNestedStructureInput, Ctx], typing.Union[json_rpc10.output.OperationWithNestedStructureOutput, typing.Awaitable[json_rpc10.output.OperationWithNestedStructureOutput]]], typing.Callable[[json_rpc10.input.OperationWithNestedStructureInput], typing.Union[json_rpc10.output.OperationWithNestedStructureOutput, typing.Awaitable[json_rpc10.output.OperationWithNestedStructureOutput]]]]) -> None:
  217         -
        """
  218         -
        Method to register `operation_with_nested_structure` Python implementation inside the handlers map.
  219         -
        It can be used as a function decorator in Python.
  220         -
        """
  221         -
        ...
  222         -
  223         -
  224         -
    def operation_with_required_members(self, func: typing.Union[typing.Callable[[json_rpc10.input.OperationWithRequiredMembersInput, Ctx], typing.Union[json_rpc10.output.OperationWithRequiredMembersOutput, typing.Awaitable[json_rpc10.output.OperationWithRequiredMembersOutput]]], typing.Callable[[json_rpc10.input.OperationWithRequiredMembersInput], typing.Union[json_rpc10.output.OperationWithRequiredMembersOutput, typing.Awaitable[json_rpc10.output.OperationWithRequiredMembersOutput]]]]) -> None:
  225         -
        """
  226         -
        Method to register `operation_with_required_members` Python implementation inside the handlers map.
  227         -
        It can be used as a function decorator in Python.
  228         -
        """
  229         -
        ...
  230         -
  231         -
  232         -
    def put_with_content_encoding(self, func: typing.Union[typing.Callable[[json_rpc10.input.PutWithContentEncodingInput, Ctx], typing.Union[json_rpc10.output.PutWithContentEncodingOutput, typing.Awaitable[json_rpc10.output.PutWithContentEncodingOutput]]], typing.Callable[[json_rpc10.input.PutWithContentEncodingInput], typing.Union[json_rpc10.output.PutWithContentEncodingOutput, typing.Awaitable[json_rpc10.output.PutWithContentEncodingOutput]]]]) -> None:
  233         -
        """
  234         -
        Method to register `put_with_content_encoding` Python implementation inside the handlers map.
  235         -
        It can be used as a function decorator in Python.
  236         -
        """
  237         -
        ...
  238         -
  239         -
  240         -
    def run(self, address: typing.Optional[str] = ..., port: typing.Optional[int] = ..., backlog: typing.Optional[int] = ..., workers: typing.Optional[int] = ..., tls: typing.Optional[json_rpc10.tls.TlsConfig] = ...) -> None:
  241         -
        """
  242         -
        Main entrypoint: start the server on multiple workers.
  243         -
        """
  244         -
        ...
  245         -
  246         -
  247         -
    def run_lambda(self) -> None:
  248         -
        """
  249         -
        Lambda entrypoint: start the server on Lambda.
  250         -
        """
  251         -
        ...
  252         -
  253         -
  254         -
    def simple_scalar_properties(self, func: typing.Union[typing.Callable[[json_rpc10.input.SimpleScalarPropertiesInput, Ctx], typing.Union[json_rpc10.output.SimpleScalarPropertiesOutput, typing.Awaitable[json_rpc10.output.SimpleScalarPropertiesOutput]]], typing.Callable[[json_rpc10.input.SimpleScalarPropertiesInput], typing.Union[json_rpc10.output.SimpleScalarPropertiesOutput, typing.Awaitable[json_rpc10.output.SimpleScalarPropertiesOutput]]]]) -> None:
  255         -
        """
  256         -
        Method to register `simple_scalar_properties` Python implementation inside the handlers map.
  257         -
        It can be used as a function decorator in Python.
  258         -
        """
  259         -
        ...
  260         -
  261         -
  262         -
    def start_worker(self) -> None:
  263         -
        """
  264         -
        Build the service and start a single worker.
  265         -
        """
  266         -
        ...
  267         -
  268         -
  269         -
    def __init__(self) -> None:
  270         -
        ...
  271         -
  272         -
  273         -
CODEGEN_VERSION: str = ...

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/aws_lambda/__init__.pyi

@@ -1,0 +143,0 @@
    1         -
import typing
    2         -
    3         -
class ClientApplication:
    4         -
    """
    5         -
    AWS Mobile SDK client fields.
    6         -
    """
    7         -
    8         -
    app_package_name: str
    9         -
    """
   10         -
    The package name for the mobile application invoking the function
   11         -
    """
   12         -
   13         -
    app_title: str
   14         -
    """
   15         -
    The app title for the mobile app as registered with AWS' mobile services.
   16         -
    """
   17         -
   18         -
    app_version_code: str
   19         -
    """
   20         -
    The app version code.
   21         -
    """
   22         -
   23         -
    app_version_name: str
   24         -
    """
   25         -
    The version name of the application as registered with AWS' mobile services.
   26         -
    """
   27         -
   28         -
    installation_id: str
   29         -
    """
   30         -
    The mobile app installation id
   31         -
    """
   32         -
   33         -
class ClientContext:
   34         -
    """
   35         -
    Client context sent by the AWS Mobile SDK.
   36         -
    """
   37         -
   38         -
    client: ClientApplication
   39         -
    """
   40         -
    Information about the mobile application invoking the function.
   41         -
    """
   42         -
   43         -
    custom: typing.Dict[str, str]
   44         -
    """
   45         -
    Custom properties attached to the mobile event context.
   46         -
    """
   47         -
   48         -
    environment: typing.Dict[str, str]
   49         -
    """
   50         -
    Environment settings from the mobile client.
   51         -
    """
   52         -
   53         -
class CognitoIdentity:
   54         -
    """
   55         -
    Cognito identity information sent with the event
   56         -
    """
   57         -
   58         -
    identity_id: str
   59         -
    """
   60         -
    The unique identity id for the Cognito credentials invoking the function.
   61         -
    """
   62         -
   63         -
    identity_pool_id: str
   64         -
    """
   65         -
    The identity pool id the caller is "registered" with.
   66         -
    """
   67         -
   68         -
class Config:
   69         -
    """
   70         -
    Configuration derived from environment variables.
   71         -
    """
   72         -
   73         -
    function_name: str
   74         -
    """
   75         -
    The name of the function.
   76         -
    """
   77         -
   78         -
    log_group: str
   79         -
    """
   80         -
    The name of the Amazon CloudWatch Logs group for the function.
   81         -
    """
   82         -
   83         -
    log_stream: str
   84         -
    """
   85         -
    The name of the Amazon CloudWatch Logs stream for the function.
   86         -
    """
   87         -
   88         -
    memory: int
   89         -
    """
   90         -
    The amount of memory available to the function in MB.
   91         -
    """
   92         -
   93         -
    version: str
   94         -
    """
   95         -
    The version of the function being executed.
   96         -
    """
   97         -
   98         -
class LambdaContext:
   99         -
    """
  100         -
    The Lambda function execution context. The values in this struct
  101         -
    are populated using the [Lambda environment variables](https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html)
  102         -
    and the headers returned by the poll request to the Runtime APIs.
  103         -
    """
  104         -
  105         -
    client_context: typing.Optional[ClientContext]
  106         -
    """
  107         -
    The client context object sent by the AWS mobile SDK. This field is
  108         -
    empty unless the function is invoked using an AWS mobile SDK.
  109         -
    """
  110         -
  111         -
    deadline: int
  112         -
    """
  113         -
    The execution deadline for the current invocation in milliseconds.
  114         -
    """
  115         -
  116         -
    env_config: Config
  117         -
    """
  118         -
    Lambda function configuration from the local environment variables.
  119         -
    Includes information such as the function name, memory allocation,
  120         -
    version, and log streams.
  121         -
    """
  122         -
  123         -
    identity: typing.Optional[CognitoIdentity]
  124         -
    """
  125         -
    The Cognito identity that invoked the function. This field is empty
  126         -
    unless the invocation request to the Lambda APIs was made using AWS
  127         -
    credentials issues by Amazon Cognito Identity Pools.
  128         -
    """
  129         -
  130         -
    invoked_function_arn: str
  131         -
    """
  132         -
    The ARN of the Lambda function being invoked.
  133         -
    """
  134         -
  135         -
    request_id: str
  136         -
    """
  137         -
    The AWS request ID generated by the Lambda service.
  138         -
    """
  139         -
  140         -
    xray_trace_id: typing.Optional[str]
  141         -
    """
  142         -
    The X-Ray trace ID for the current invocation.
  143         -
    """

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/error/__init__.pyi

@@ -1,0 +61,0 @@
    1         -
import json_rpc10.model
    2         -
import typing
    3         -
    4         -
class ComplexError(Exception):
    5         -
    """
    6         -
    This error is thrown when a request is invalid.
    7         -
    """
    8         -
    9         -
    nested: typing.Optional[json_rpc10.model.ComplexNestedErrorData]
   10         -
   11         -
    top_level: typing.Optional[str]
   12         -
   13         -
    def __init__(self, top_level: typing.Optional[str] = ..., nested: typing.Optional[json_rpc10.model.ComplexNestedErrorData] = ...) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class FooError(Exception):
   18         -
    """
   19         -
    This error has test cases that test some of the dark corners of Amazon service framework history. It should only be implemented by clients.
   20         -
    """
   21         -
   22         -
    def __init__(self) -> None:
   23         -
        ...
   24         -
   25         -
   26         -
class InternalServerError(Exception):
   27         -
    message: str
   28         -
   29         -
    def __init__(self, message: str) -> None:
   30         -
        ...
   31         -
   32         -
   33         -
class InvalidGreeting(Exception):
   34         -
    """
   35         -
    This error is thrown when an invalid greeting value is provided.
   36         -
    """
   37         -
   38         -
    message: typing.Optional[str]
   39         -
   40         -
    def __init__(self, message: typing.Optional[str] = ...) -> None:
   41         -
        ...
   42         -
   43         -
   44         -
class ValidationException(Exception):
   45         -
    """
   46         -
    A standard error for input validation failures. This should be thrown by services when a member of the input structure falls outside of the modeled or documented constraints.
   47         -
    """
   48         -
   49         -
    field_list: typing.Optional[typing.List[json_rpc10.model.ValidationExceptionField]]
   50         -
    """
   51         -
    A list of specific failures encountered while validating the input. A member can appear in this list more than once if it failed to satisfy multiple constraints.
   52         -
    """
   53         -
   54         -
    message: str
   55         -
    """
   56         -
    A summary of the validation failure.
   57         -
    """
   58         -
   59         -
    def __init__(self, message: str, field_list: typing.Optional[typing.List[json_rpc10.model.ValidationExceptionField]] = ...) -> None:
   60         -
        ...
   61         -

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/input/__init__.pyi

@@ -1,0 +101,0 @@
    1         -
import json_rpc10.model
    2         -
import typing
    3         -
    4         -
class ContentTypeParametersInput:
    5         -
    value: typing.Optional[int]
    6         -
    7         -
    def __init__(self, value: typing.Optional[int] = ...) -> None:
    8         -
        ...
    9         -
   10         -
   11         -
class EmptyInputAndEmptyOutputInput:
   12         -
    def __init__(self) -> None:
   13         -
        ...
   14         -
   15         -
   16         -
class EndpointOperationInput:
   17         -
    def __init__(self) -> None:
   18         -
        ...
   19         -
   20         -
   21         -
class EndpointWithHostLabelOperationInput:
   22         -
    label: str
   23         -
   24         -
    def __init__(self, label: str) -> None:
   25         -
        ...
   26         -
   27         -
   28         -
class GreetingWithErrorsInput:
   29         -
    greeting: typing.Optional[str]
   30         -
   31         -
    def __init__(self, greeting: typing.Optional[str] = ...) -> None:
   32         -
        ...
   33         -
   34         -
   35         -
class HostWithPathOperationInput:
   36         -
    def __init__(self) -> None:
   37         -
        ...
   38         -
   39         -
   40         -
class JsonUnionsInput:
   41         -
    contents: typing.Optional[json_rpc10.model.MyUnion]
   42         -
    """
   43         -
    A union with a representative set of types for members.
   44         -
    """
   45         -
   46         -
    def __init__(self, contents: typing.Optional[json_rpc10.model.MyUnion] = ...) -> None:
   47         -
        ...
   48         -
   49         -
   50         -
class NoInputAndNoOutputInput:
   51         -
    def __init__(self) -> None:
   52         -
        ...
   53         -
   54         -
   55         -
class NoInputAndOutputInput:
   56         -
    def __init__(self) -> None:
   57         -
        ...
   58         -
   59         -
   60         -
class OperationWithDefaultsInput:
   61         -
    client_optional_defaults: typing.Optional[json_rpc10.model.ClientOptionalDefaults]
   62         -
   63         -
    defaults: typing.Optional[json_rpc10.model.Defaults]
   64         -
   65         -
    other_top_level_default: int
   66         -
   67         -
    top_level_default: str
   68         -
   69         -
    def __init__(self, defaults: typing.Optional[json_rpc10.model.Defaults] = ..., client_optional_defaults: typing.Optional[json_rpc10.model.ClientOptionalDefaults] = ..., top_level_default: str, other_top_level_default: int) -> None:
   70         -
        ...
   71         -
   72         -
   73         -
class OperationWithNestedStructureInput:
   74         -
    top_level: json_rpc10.model.TopLevel
   75         -
   76         -
    def __init__(self, top_level: json_rpc10.model.TopLevel) -> None:
   77         -
        ...
   78         -
   79         -
   80         -
class OperationWithRequiredMembersInput:
   81         -
    def __init__(self) -> None:
   82         -
        ...
   83         -
   84         -
   85         -
class PutWithContentEncodingInput:
   86         -
    data: typing.Optional[str]
   87         -
   88         -
    encoding: typing.Optional[str]
   89         -
   90         -
    def __init__(self, encoding: typing.Optional[str] = ..., data: typing.Optional[str] = ...) -> None:
   91         -
        ...
   92         -
   93         -
   94         -
class SimpleScalarPropertiesInput:
   95         -
    double_value: typing.Optional[float]
   96         -
   97         -
    float_value: typing.Optional[float]
   98         -
   99         -
    def __init__(self, float_value: typing.Optional[float] = ..., double_value: typing.Optional[float] = ...) -> None:
  100         -
        ...
  101         -

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/logging/__init__.pyi

@@ -1,0 +26,0 @@
    1         -
import pathlib
    2         -
import typing
    3         -
    4         -
class TracingHandler:
    5         -
    """
    6         -
    Modifies the Python `logging` module to deliver its log messages using [tracing::Subscriber] events.
    7         -
    8         -
    To achieve this goal, the following changes are made to the module:
    9         -
    - A new builtin function `logging.py_tracing_event` transcodes `logging.LogRecord`s to `tracing::Event`s. This function
   10         -
      is not exported in `logging.__all__`, as it is not intended to be called directly.
   11         -
    - A new class `logging.TracingHandler` provides a `logging.Handler` that delivers all records to `python_tracing`.
   12         -
    """
   13         -
   14         -
    def handler(self) -> typing.Any:
   15         -
        ...
   16         -
   17         -
   18         -
    def __init__(self, level: typing.Optional[int] = ..., logfile: typing.Optional[pathlib.Path] = ..., format: typing.Optional[typing.Literal['compact', 'pretty', 'json']] = ...) -> None:
   19         -
        ...
   20         -
   21         -
   22         -
def py_tracing_event() -> None:
   23         -
    """
   24         -
    Consumes a Python `logging.LogRecord` and emits a Rust [tracing::Event] instead.
   25         -
    """
   26         -
    ...

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/middleware/__init__.pyi

@@ -1,0 +78,0 @@
    1         -
import typing
    2         -
    3         -
class MiddlewareException(Exception):
    4         -
    """
    5         -
    Exception that can be thrown from a Python middleware.
    6         -
    7         -
    It allows to specify a message and HTTP status code and implementing protocol specific capabilities
    8         -
    to build a [aws_smithy_http_server::response::Response] from it.
    9         -
    """
   10         -
   11         -
    message: str
   12         -
   13         -
    status_code: int
   14         -
   15         -
    def __init__(self, message: str, status_code: typing.Optional[int] = ...) -> None:
   16         -
        ...
   17         -
   18         -
   19         -
class Request:
   20         -
    """
   21         -
    Python-compatible [Request] object.
   22         -
    """
   23         -
   24         -
    body: typing.Awaitable[bytes]
   25         -
    """
   26         -
    Return the HTTP body of this request.
   27         -
    Note that this is a costly operation because the whole request body is cloned.
   28         -
    """
   29         -
   30         -
    headers: typing.MutableMapping[str, str]
   31         -
    """
   32         -
    Return the HTTP headers of this request.
   33         -
    """
   34         -
   35         -
    method: str
   36         -
    """
   37         -
    Return the HTTP method of this request.
   38         -
    """
   39         -
   40         -
    uri: str
   41         -
    """
   42         -
    Return the URI of this request.
   43         -
    """
   44         -
   45         -
    version: str
   46         -
    """
   47         -
    Return the HTTP version of this request.
   48         -
    """
   49         -
   50         -
class Response:
   51         -
    """
   52         -
    Python-compatible [Response] object.
   53         -
    """
   54         -
   55         -
    body: typing.Awaitable[bytes]
   56         -
    """
   57         -
    Return the HTTP body of this response.
   58         -
    Note that this is a costly operation because the whole response body is cloned.
   59         -
    """
   60         -
   61         -
    headers: typing.MutableMapping[str, str]
   62         -
    """
   63         -
    Return the HTTP headers of this response.
   64         -
    """
   65         -
   66         -
    status: int
   67         -
    """
   68         -
    Return the HTTP status of this response.
   69         -
    """
   70         -
   71         -
    version: str
   72         -
    """
   73         -
    Return the HTTP version of this response.
   74         -
    """
   75         -
   76         -
    def __init__(self, status: int, headers: typing.Optional[typing.Dict[str, str]] = ..., body: typing.Optional[bytes] = ...) -> None:
   77         -
        ...
   78         -

tmp-codegen-diff/codegen-server-test-python/json_rpc10/rust-server-codegen-python/python/json_rpc10/model/__init__.pyi

@@ -1,0 +380,0 @@
    1         -
import json_rpc10.model
    2         -
import json_rpc10.types
    3         -
import typing
    4         -
    5         -
class ClientOptionalDefaults:
    6         -
    member: int
    7         -
    8         -
    def __init__(self, member: int) -> None:
    9         -
        ...
   10         -
   11         -
   12         -
class ComplexNestedErrorData:
   13         -
    foo: typing.Optional[str]
   14         -
   15         -
    def __init__(self, foo: typing.Optional[str] = ...) -> None:
   16         -
        ...
   17         -
   18         -
   19         -
class Defaults:
   20         -
    default_blob: json_rpc10.types.Blob
   21         -
   22         -
    default_boolean: bool
   23         -
   24         -
    default_byte: int
   25         -
   26         -
    default_document_boolean: json_rpc10.types.Document
   27         -
   28         -
    default_document_list: json_rpc10.types.Document
   29         -
   30         -
    default_document_map: json_rpc10.types.Document
   31         -
   32         -
    default_document_string: json_rpc10.types.Document
   33         -
   34         -
    default_double: float
   35         -
   36         -
    default_enum: json_rpc10.model.TestEnum
   37         -
   38         -
    default_float: float
   39         -
   40         -
    default_int_enum: int
   41         -
   42         -
    default_integer: int
   43         -
   44         -
    default_list: typing.List[str]
   45         -
   46         -
    default_long: int
   47         -
   48         -
    default_map: typing.Dict[str, str]
   49         -
   50         -
    default_null_document: typing.Optional[json_rpc10.types.Document]
   51         -
   52         -
    default_short: int
   53         -
   54         -
    default_string: str
   55         -
   56         -
    default_timestamp: json_rpc10.types.DateTime
   57         -
   58         -
    empty_blob: json_rpc10.types.Blob
   59         -
   60         -
    empty_string: str
   61         -
   62         -
    false_boolean: bool
   63         -
   64         -
    zero_byte: int
   65         -
   66         -
    zero_double: float
   67         -
   68         -
    zero_float: float
   69         -
   70         -
    zero_integer: int
   71         -
   72         -
    zero_long: int
   73         -
   74         -
    zero_short: int
   75         -
   76         -
    def __init__(self, default_string: str, default_boolean: bool, default_list: typing.List[str], default_document_map: json_rpc10.types.Document, default_document_string: json_rpc10.types.Document, default_document_boolean: json_rpc10.types.Document, default_document_list: json_rpc10.types.Document, default_null_document: typing.Optional[json_rpc10.types.Document] = ..., default_timestamp: json_rpc10.types.DateTime, default_blob: json_rpc10.types.Blob, default_byte: int, default_short: int, default_integer: int, default_long: int, default_float: float, default_double: float, default_map: typing.Dict[str, str], default_enum: json_rpc10.model.TestEnum, default_int_enum: int, empty_string: str, false_boolean: bool, empty_blob: json_rpc10.types.Blob, zero_byte: int, zero_short: int, zero_integer: int, zero_long: int, zero_float: float, zero_double: float) -> None:
   77         -
        ...
   78         -
   79         -
   80         -
class Dialog:
   81         -
    farewell: typing.Optional[json_rpc10.model.Farewell]
   82         -
   83         -
    greeting: str
   84         -
   85         -
    language: typing.Optional[str]
   86         -
   87         -
    def __init__(self, language: typing.Optional[str] = ..., greeting: str, farewell: typing.Optional[json_rpc10.model.Farewell] = ...) -> None:
   88         -
        ...
   89         -
   90         -
   91         -
class Farewell:
   92         -
    phrase: str
   93         -
   94         -
    def __init__(self, phrase: str) -> None:
   95         -
        ...
   96         -
   97         -
   98         -
class FooEnum:
   99         -
    Bar: FooEnum
  100         -
  101         -
    Baz: FooEnum
  102         -
  103         -
    Foo: FooEnum
  104         -
  105         -
    One: FooEnum
  106         -
  107         -
    Zero: FooEnum
  108         -
  109         -
    name: typing.Any
  110         -
  111         -
    value: typing.Any
  112         -
  113         -
class GreetingStruct:
  114         -
    hi: typing.Optional[str]
  115         -
  116         -
    def __init__(self, hi: typing.Optional[str] = ...) -> None:
  117         -
        ...
  118         -
  119         -
  120         -
class MyUnion:
  121         -
    def as_blob_value(self) -> json_rpc10.types.Blob:
  122         -
        """
  123         -
        Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
  124         -
        """
  125         -
        ...
  126         -
  127         -
  128         -
    def as_boolean_value(self) -> bool:
  129         -
        """
  130         -
        Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
  131         -
        """
  132         -
        ...
  133         -
  134         -
  135         -
    def as_enum_value(self) -> json_rpc10.model.FooEnum:
  136         -
        """
  137         -
        Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
  138         -
        """
  139         -
        ...
  140         -
  141         -
  142         -
    def as_int_enum_value(self) -> int:
  143         -
        """
  144         -
        Tries to convert the enum instance into [`IntEnumValue`](crate::model::MyUnion::IntEnumValue), extracting the inner [`i32`](i32).
  145         -
        """
  146         -
        ...
  147         -
  148         -
  149         -
    def as_list_value(self) -> typing.List[str]:
  150         -
        """
  151         -
        Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
  152         -
        """
  153         -
        ...
  154         -
  155         -
  156         -
    def as_map_value(self) -> typing.Dict[str, str]:
  157         -
        """
  158         -
        Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
  159         -
        """
  160         -
        ...
  161         -
  162         -
  163         -
    def as_number_value(self) -> int:
  164         -
        """
  165         -
        Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
  166         -
        """
  167         -
        ...
  168         -
  169         -
  170         -
    def as_string_value(self) -> str:
  171         -
        """
  172         -
        Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
  173         -
        """
  174         -
        ...
  175         -
  176         -
  177         -
    def as_structure_value(self) -> json_rpc10.model.GreetingStruct:
  178         -
        """
  179         -
        Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
  180         -
        """
  181         -
        ...
  182         -
  183         -
  184         -
    def as_timestamp_value(self) -> json_rpc10.types.DateTime:
  185         -
        """
  186         -
        Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
  187         -
        """
  188         -
        ...
  189         -
  190         -
  191         -
    @staticmethod
  192         -
    def blob_value(data: json_rpc10.types.Blob) -> MyUnion:
  193         -
        """
  194         -
        Creates a new union instance of [`BlobValue`](crate::model::MyUnion::BlobValue)
  195         -
        """
  196         -
        ...
  197         -
  198         -
  199         -
    @staticmethod
  200         -
    def boolean_value(data: bool) -> MyUnion:
  201         -
        """
  202         -
        Creates a new union instance of [`BooleanValue`](crate::model::MyUnion::BooleanValue)
  203         -
        """
  204         -
        ...
  205         -
  206         -
  207         -
    @staticmethod
  208         -
    def enum_value(data: json_rpc10.model.FooEnum) -> MyUnion:
  209         -
        """
  210         -
        Creates a new union instance of [`EnumValue`](crate::model::MyUnion::EnumValue)
  211         -
        """
  212         -
        ...
  213         -
  214         -
  215         -
    @staticmethod
  216         -
    def int_enum_value(data: int) -> MyUnion:
  217         -
        """
  218         -
        Creates a new union instance of [`IntEnumValue`](crate::model::MyUnion::IntEnumValue)
  219         -
        """
  220         -
        ...
  221         -
  222         -
  223         -
    def is_blob_value(self) -> bool:
  224         -
        """
  225         -
        Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
  226         -
        """
  227         -
        ...
  228         -
  229         -
  230         -
    def is_boolean_value(self) -> bool:
  231         -
        """
  232         -
        Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
  233         -
        """
  234         -
        ...
  235         -
  236         -
  237         -
    def is_enum_value(self) -> bool:
  238         -
        """
  239         -
        Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
  240         -
        """
  241         -
        ...
  242         -
  243         -
  244         -
    def is_int_enum_value(self) -> bool:
  245         -
        """
  246         -
        Returns true if this is a [`IntEnumValue`](crate::model::MyUnion::IntEnumValue).
  247         -
        """
  248         -
        ...
  249         -
  250         -
  251         -
    def is_list_value(self) -> bool:
  252         -
        """
  253         -
        Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
  254         -
        """
  255         -
        ...
  256         -
  257         -
  258         -
    def is_map_value(self) -> bool:
  259         -
        """
  260         -
        Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
  261         -
        """
  262         -
        ...
  263         -
  264         -
  265         -
    def is_number_value(self) -> bool:
  266         -
        """
  267         -
        Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
  268         -
        """
  269         -
        ...
  270         -
  271         -
  272         -
    def is_string_value(self) -> bool:
  273         -
        """
  274         -
        Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
  275         -
        """
  276         -
        ...
  277         -
  278         -
  279         -
    def is_structure_value(self) -> bool:
  280         -
        """
  281         -
        Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
  282         -
        """
  283         -
        ...
  284         -
  285         -
  286         -
    def is_timestamp_value(self) -> bool:
  287         -
        """
  288         -
        Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
  289         -
        """
  290         -
        ...
  291         -
  292         -
  293         -
    @staticmethod
  294         -
    def list_value(data: typing.List[str]) -> MyUnion:
  295         -
        """
  296         -
        Creates a new union instance of [`ListValue`](crate::model::MyUnion::ListValue)
  297         -
        """
  298         -
        ...
  299         -
  300         -
  301         -
    @staticmethod
  302         -
    def map_value(data: typing.Dict[str, str]) -> MyUnion:
  303         -
        """
  304         -
        Creates a new union instance of [`MapValue`](crate::model::MyUnion::MapValue)
  305         -
        """
  306         -
        ...
  307         -
  308         -
  309         -
    @staticmethod
  310         -
    def number_value(data: int) -> MyUnion:
  311         -
        """
  312         -
        Creates a new union instance of [`NumberValue`](crate::model::MyUnion::NumberValue)
  313         -
        """
  314         -
        ...
  315         -
  316         -
  317         -
    @staticmethod
  318         -
    def string_value(data: str) -> MyUnion:
  319         -
        """
  320         -
        Creates a new union instance of [`StringValue`](crate::model::MyUnion::StringValue)
  321         -
        """
  322         -
        ...
  323         -
  324         -
  325         -
    @staticmethod
  326         -
    def structure_value(data: json_rpc10.model.GreetingStruct) -> MyUnion:
  327         -
        """
  328         -
        Creates a new union instance of [`StructureValue`](crate::model::MyUnion::StructureValue)
  329         -
        """
  330         -
        ...
  331         -
  332         -
  333         -
    @staticmethod
  334         -
    def timestamp_value(data: json_rpc10.types.DateTime) -> MyUnion:
  335         -
        """
  336         -
        Creates a new union instance of [`TimestampValue`](crate::model::MyUnion::TimestampValue)
  337         -
        """
  338         -
        ...
  339         -
  340         -
  341         -
class TestEnum:
  342         -
    Bar: TestEnum
  343         -
  344         -
    Baz: TestEnum
  345         -
  346         -
    Foo: TestEnum
  347         -
  348         -
    name: typing.Any
  349         -
  350         -
    value: typing.Any
  351         -
  352         -
class TopLevel:
  353         -
    dialog: json_rpc10.model.Dialog
  354         -
  355         -
    dialog_list: typing.List[json_rpc10.model.Dialog]
  356         -
  357         -
    dialog_map: typing.Dict[str, json_rpc10.model.Dialog]
  358         -
  359         -
    def __init__(self, dialog: json_rpc10.model.Dialog, dialog_list: typing.List[json_rpc10.model.Dialog], dialog_map: typing.Dict[str, json_rpc10.model.Dialog]) -> None:
  360         -
        ...
  361         -
  362         -
  363         -
class ValidationExceptionField:
  364         -
    """
  365         -
    Describes one specific validation failure for an input member.
  366         -
    """
  367         -
  368         -
    message: str
  369         -
    """
  370         -
    A detailed description of the validation failure.
  371         -
    """
  372         -
  373         -
    path: str
  374         -
    """
  375         -
    A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  376         -
    """
  377         -
  378         -
    def __init__(self, path: str, message: str) -> None:
  379         -
        ...
  380         -