Server Test Python

Server Test Python

rev. 1d902e1fdfff69f8aafe42b2306fa317ef96d562 (ignoring whitespace)

Files changed:

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

@@ -1,0 +183,0 @@
    1         -
import json_rpc11.model
    2         -
import json_rpc11.types
    3         -
import typing
    4         -
    5         -
class ContentTypeParametersInput:
    6         -
    value: typing.Optional[int]
    7         -
    8         -
    def __init__(self, value: typing.Optional[int] = ...) -> None:
    9         -
        ...
   10         -
   11         -
   12         -
class DatetimeOffsetsInput:
   13         -
    def __init__(self) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class EmptyOperationInput:
   18         -
    def __init__(self) -> None:
   19         -
        ...
   20         -
   21         -
   22         -
class EndpointOperationInput:
   23         -
    def __init__(self) -> None:
   24         -
        ...
   25         -
   26         -
   27         -
class EndpointWithHostLabelOperationInput:
   28         -
    label: str
   29         -
   30         -
    def __init__(self, label: str) -> None:
   31         -
        ...
   32         -
   33         -
   34         -
class FractionalSecondsInput:
   35         -
    def __init__(self) -> None:
   36         -
        ...
   37         -
   38         -
   39         -
class GreetingWithErrorsInput:
   40         -
    def __init__(self) -> None:
   41         -
        ...
   42         -
   43         -
   44         -
class HostWithPathOperationInput:
   45         -
    def __init__(self) -> None:
   46         -
        ...
   47         -
   48         -
   49         -
class JsonEnumsInput:
   50         -
    foo_enum1: typing.Optional[json_rpc11.model.FooEnum]
   51         -
   52         -
    foo_enum2: typing.Optional[json_rpc11.model.FooEnum]
   53         -
   54         -
    foo_enum3: typing.Optional[json_rpc11.model.FooEnum]
   55         -
   56         -
    foo_enum_list: typing.Optional[typing.List[json_rpc11.model.FooEnum]]
   57         -
   58         -
    foo_enum_map: typing.Optional[typing.Dict[str, json_rpc11.model.FooEnum]]
   59         -
   60         -
    foo_enum_set: typing.Optional[typing.List[json_rpc11.model.FooEnum]]
   61         -
   62         -
    def __init__(self, foo_enum1: typing.Optional[json_rpc11.model.FooEnum] = ..., foo_enum2: typing.Optional[json_rpc11.model.FooEnum] = ..., foo_enum3: typing.Optional[json_rpc11.model.FooEnum] = ..., foo_enum_list: typing.Optional[typing.List[json_rpc11.model.FooEnum]] = ..., foo_enum_set: typing.Optional[typing.List[json_rpc11.model.FooEnum]] = ..., foo_enum_map: typing.Optional[typing.Dict[str, json_rpc11.model.FooEnum]] = ...) -> None:
   63         -
        ...
   64         -
   65         -
   66         -
class JsonUnionsInput:
   67         -
    """
   68         -
    A shared structure that contains a single union member.
   69         -
    """
   70         -
   71         -
    contents: typing.Optional[json_rpc11.model.MyUnion]
   72         -
    """
   73         -
    A union with a representative set of types for members.
   74         -
    """
   75         -
   76         -
    def __init__(self, contents: typing.Optional[json_rpc11.model.MyUnion] = ...) -> None:
   77         -
        ...
   78         -
   79         -
   80         -
class KitchenSinkOperationInput:
   81         -
    blob: typing.Optional[json_rpc11.types.Blob]
   82         -
   83         -
    boolean: typing.Optional[bool]
   84         -
   85         -
    double: typing.Optional[float]
   86         -
   87         -
    empty_struct: typing.Optional[json_rpc11.model.EmptyStruct]
   88         -
   89         -
    float: typing.Optional[float]
   90         -
   91         -
    httpdate_timestamp: typing.Optional[json_rpc11.types.DateTime]
   92         -
   93         -
    integer: typing.Optional[int]
   94         -
   95         -
    iso8601_timestamp: typing.Optional[json_rpc11.types.DateTime]
   96         -
   97         -
    json_value: typing.Optional[str]
   98         -
   99         -
    list_of_lists: typing.Optional[typing.List[typing.List[str]]]
  100         -
  101         -
    list_of_maps_of_strings: typing.Optional[typing.List[typing.Dict[str, str]]]
  102         -
  103         -
    list_of_strings: typing.Optional[typing.List[str]]
  104         -
  105         -
    list_of_structs: typing.Optional[typing.List[json_rpc11.model.SimpleStruct]]
  106         -
  107         -
    long: typing.Optional[int]
  108         -
  109         -
    map_of_lists_of_strings: typing.Optional[typing.Dict[str, typing.List[str]]]
  110         -
  111         -
    map_of_maps: typing.Optional[typing.Dict[str, typing.Dict[str, str]]]
  112         -
  113         -
    map_of_strings: typing.Optional[typing.Dict[str, str]]
  114         -
  115         -
    map_of_structs: typing.Optional[typing.Dict[str, json_rpc11.model.SimpleStruct]]
  116         -
  117         -
    recursive_list: typing.Optional[typing.List[json_rpc11.model.KitchenSink]]
  118         -
  119         -
    recursive_map: typing.Optional[typing.Dict[str, json_rpc11.model.KitchenSink]]
  120         -
  121         -
    recursive_struct: typing.Optional[json_rpc11.model.KitchenSink]
  122         -
  123         -
    simple_struct: typing.Optional[json_rpc11.model.SimpleStruct]
  124         -
  125         -
    string: typing.Optional[str]
  126         -
  127         -
    struct_with_json_name: typing.Optional[json_rpc11.model.StructWithJsonName]
  128         -
  129         -
    timestamp: typing.Optional[json_rpc11.types.DateTime]
  130         -
  131         -
    unix_timestamp: typing.Optional[json_rpc11.types.DateTime]
  132         -
  133         -
    def __init__(self, blob: typing.Optional[json_rpc11.types.Blob] = ..., boolean: typing.Optional[bool] = ..., double: typing.Optional[float] = ..., empty_struct: typing.Optional[json_rpc11.model.EmptyStruct] = ..., float: typing.Optional[float] = ..., httpdate_timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., integer: typing.Optional[int] = ..., iso8601_timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., json_value: typing.Optional[str] = ..., list_of_lists: typing.Optional[typing.List[typing.List[str]]] = ..., list_of_maps_of_strings: typing.Optional[typing.List[typing.Dict[str, str]]] = ..., list_of_strings: typing.Optional[typing.List[str]] = ..., list_of_structs: typing.Optional[typing.List[json_rpc11.model.SimpleStruct]] = ..., long: typing.Optional[int] = ..., map_of_lists_of_strings: typing.Optional[typing.Dict[str, typing.List[str]]] = ..., map_of_maps: typing.Optional[typing.Dict[str, typing.Dict[str, str]]] = ..., map_of_strings: typing.Optional[typing.Dict[str, str]] = ..., map_of_structs: typing.Optional[typing.Dict[str, json_rpc11.model.SimpleStruct]] = ..., recursive_list: typing.Optional[typing.List[json_rpc11.model.KitchenSink]] = ..., recursive_map: typing.Optional[typing.Dict[str, json_rpc11.model.KitchenSink]] = ..., recursive_struct: typing.Optional[json_rpc11.model.KitchenSink] = ..., simple_struct: typing.Optional[json_rpc11.model.SimpleStruct] = ..., string: typing.Optional[str] = ..., struct_with_json_name: typing.Optional[json_rpc11.model.StructWithJsonName] = ..., timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., unix_timestamp: typing.Optional[json_rpc11.types.DateTime] = ...) -> None:
  134         -
        ...
  135         -
  136         -
  137         -
class NullOperationInput:
  138         -
    string: typing.Optional[str]
  139         -
  140         -
    def __init__(self, string: typing.Optional[str] = ...) -> None:
  141         -
        ...
  142         -
  143         -
  144         -
class OperationWithOptionalInputOutputInput:
  145         -
    value: typing.Optional[str]
  146         -
  147         -
    def __init__(self, value: typing.Optional[str] = ...) -> None:
  148         -
        ...
  149         -
  150         -
  151         -
class PutAndGetInlineDocumentsInput:
  152         -
    inline_document: typing.Optional[json_rpc11.types.Document]
  153         -
  154         -
    def __init__(self, inline_document: typing.Optional[json_rpc11.types.Document] = ...) -> None:
  155         -
        ...
  156         -
  157         -
  158         -
class PutWithContentEncodingInput:
  159         -
    data: typing.Optional[str]
  160         -
  161         -
    encoding: typing.Optional[str]
  162         -
  163         -
    def __init__(self, encoding: typing.Optional[str] = ..., data: typing.Optional[str] = ...) -> None:
  164         -
        ...
  165         -
  166         -
  167         -
class SimpleScalarPropertiesInput:
  168         -
    double_value: typing.Optional[float]
  169         -
  170         -
    float_value: typing.Optional[float]
  171         -
  172         -
    def __init__(self, float_value: typing.Optional[float] = ..., double_value: typing.Optional[float] = ...) -> None:
  173         -
        ...
  174         -
  175         -
  176         -
class SparseNullsOperationInput:
  177         -
    sparse_string_list: typing.Optional[typing.List[typing.Optional[str]]]
  178         -
  179         -
    sparse_string_map: typing.Optional[typing.Dict[str, typing.Optional[str]]]
  180         -
  181         -
    def __init__(self, sparse_string_list: typing.Optional[typing.List[typing.Optional[str]]] = ..., sparse_string_map: typing.Optional[typing.Dict[str, typing.Optional[str]]] = ...) -> None:
  182         -
        ...
  183         -

tmp-codegen-diff/codegen-server-test-python/json_rpc11/rust-server-codegen-python/python/json_rpc11/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_rpc11/rust-server-codegen-python/python/json_rpc11/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_rpc11/rust-server-codegen-python/python/json_rpc11/model/__init__.pyi

@@ -1,0 +326,0 @@
    1         -
import json_rpc11.model
    2         -
import json_rpc11.types
    3         -
import typing
    4         -
    5         -
class ComplexNestedErrorData:
    6         -
    foo: typing.Optional[str]
    7         -
    8         -
    def __init__(self, foo: typing.Optional[str] = ...) -> None:
    9         -
        ...
   10         -
   11         -
   12         -
class EmptyStruct:
   13         -
    def __init__(self) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class FooEnum:
   18         -
    Bar: FooEnum
   19         -
   20         -
    Baz: FooEnum
   21         -
   22         -
    Foo: FooEnum
   23         -
   24         -
    One: FooEnum
   25         -
   26         -
    Zero: FooEnum
   27         -
   28         -
    name: typing.Any
   29         -
   30         -
    value: typing.Any
   31         -
   32         -
class GreetingStruct:
   33         -
    hi: typing.Optional[str]
   34         -
   35         -
    def __init__(self, hi: typing.Optional[str] = ...) -> None:
   36         -
        ...
   37         -
   38         -
   39         -
class KitchenSink:
   40         -
    blob: typing.Optional[json_rpc11.types.Blob]
   41         -
   42         -
    boolean: typing.Optional[bool]
   43         -
   44         -
    double: typing.Optional[float]
   45         -
   46         -
    empty_struct: typing.Optional[json_rpc11.model.EmptyStruct]
   47         -
   48         -
    float: typing.Optional[float]
   49         -
   50         -
    httpdate_timestamp: typing.Optional[json_rpc11.types.DateTime]
   51         -
   52         -
    integer: typing.Optional[int]
   53         -
   54         -
    iso8601_timestamp: typing.Optional[json_rpc11.types.DateTime]
   55         -
   56         -
    json_value: typing.Optional[str]
   57         -
   58         -
    list_of_lists: typing.Optional[typing.List[typing.List[str]]]
   59         -
   60         -
    list_of_maps_of_strings: typing.Optional[typing.List[typing.Dict[str, str]]]
   61         -
   62         -
    list_of_strings: typing.Optional[typing.List[str]]
   63         -
   64         -
    list_of_structs: typing.Optional[typing.List[json_rpc11.model.SimpleStruct]]
   65         -
   66         -
    long: typing.Optional[int]
   67         -
   68         -
    map_of_lists_of_strings: typing.Optional[typing.Dict[str, typing.List[str]]]
   69         -
   70         -
    map_of_maps: typing.Optional[typing.Dict[str, typing.Dict[str, str]]]
   71         -
   72         -
    map_of_strings: typing.Optional[typing.Dict[str, str]]
   73         -
   74         -
    map_of_structs: typing.Optional[typing.Dict[str, json_rpc11.model.SimpleStruct]]
   75         -
   76         -
    recursive_list: typing.Optional[typing.List[json_rpc11.model.KitchenSink]]
   77         -
   78         -
    recursive_map: typing.Optional[typing.Dict[str, json_rpc11.model.KitchenSink]]
   79         -
   80         -
    recursive_struct: typing.Optional[json_rpc11.model.KitchenSink]
   81         -
   82         -
    simple_struct: typing.Optional[json_rpc11.model.SimpleStruct]
   83         -
   84         -
    string: typing.Optional[str]
   85         -
   86         -
    struct_with_json_name: typing.Optional[json_rpc11.model.StructWithJsonName]
   87         -
   88         -
    timestamp: typing.Optional[json_rpc11.types.DateTime]
   89         -
   90         -
    unix_timestamp: typing.Optional[json_rpc11.types.DateTime]
   91         -
   92         -
    def __init__(self, blob: typing.Optional[json_rpc11.types.Blob] = ..., boolean: typing.Optional[bool] = ..., double: typing.Optional[float] = ..., empty_struct: typing.Optional[json_rpc11.model.EmptyStruct] = ..., float: typing.Optional[float] = ..., httpdate_timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., integer: typing.Optional[int] = ..., iso8601_timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., json_value: typing.Optional[str] = ..., list_of_lists: typing.Optional[typing.List[typing.List[str]]] = ..., list_of_maps_of_strings: typing.Optional[typing.List[typing.Dict[str, str]]] = ..., list_of_strings: typing.Optional[typing.List[str]] = ..., list_of_structs: typing.Optional[typing.List[json_rpc11.model.SimpleStruct]] = ..., long: typing.Optional[int] = ..., map_of_lists_of_strings: typing.Optional[typing.Dict[str, typing.List[str]]] = ..., map_of_maps: typing.Optional[typing.Dict[str, typing.Dict[str, str]]] = ..., map_of_strings: typing.Optional[typing.Dict[str, str]] = ..., map_of_structs: typing.Optional[typing.Dict[str, json_rpc11.model.SimpleStruct]] = ..., recursive_list: typing.Optional[typing.List[json_rpc11.model.KitchenSink]] = ..., recursive_map: typing.Optional[typing.Dict[str, json_rpc11.model.KitchenSink]] = ..., recursive_struct: typing.Optional[json_rpc11.model.KitchenSink] = ..., simple_struct: typing.Optional[json_rpc11.model.SimpleStruct] = ..., string: typing.Optional[str] = ..., struct_with_json_name: typing.Optional[json_rpc11.model.StructWithJsonName] = ..., timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., unix_timestamp: typing.Optional[json_rpc11.types.DateTime] = ...) -> None:
   93         -
        ...
   94         -
   95         -
   96         -
class MyUnion:
   97         -
    def as_blob_value(self) -> json_rpc11.types.Blob:
   98         -
        """
   99         -
        Tries to convert the enum instance into [`BlobValue`](crate::model::MyUnion::BlobValue), extracting the inner [`Blob`](::aws_smithy_http_server_python::types::Blob).
  100         -
        """
  101         -
        ...
  102         -
  103         -
  104         -
    def as_boolean_value(self) -> bool:
  105         -
        """
  106         -
        Tries to convert the enum instance into [`BooleanValue`](crate::model::MyUnion::BooleanValue), extracting the inner [`bool`](bool).
  107         -
        """
  108         -
        ...
  109         -
  110         -
  111         -
    def as_enum_value(self) -> json_rpc11.model.FooEnum:
  112         -
        """
  113         -
        Tries to convert the enum instance into [`EnumValue`](crate::model::MyUnion::EnumValue), extracting the inner [`FooEnum`](crate::model::FooEnum).
  114         -
        """
  115         -
        ...
  116         -
  117         -
  118         -
    def as_list_value(self) -> typing.List[str]:
  119         -
        """
  120         -
        Tries to convert the enum instance into [`ListValue`](crate::model::MyUnion::ListValue), extracting the inner [`Vec`](::std::vec::Vec).
  121         -
        """
  122         -
        ...
  123         -
  124         -
  125         -
    def as_map_value(self) -> typing.Dict[str, str]:
  126         -
        """
  127         -
        Tries to convert the enum instance into [`MapValue`](crate::model::MyUnion::MapValue), extracting the inner [`HashMap`](::std::collections::HashMap).
  128         -
        """
  129         -
        ...
  130         -
  131         -
  132         -
    def as_number_value(self) -> int:
  133         -
        """
  134         -
        Tries to convert the enum instance into [`NumberValue`](crate::model::MyUnion::NumberValue), extracting the inner [`i32`](i32).
  135         -
        """
  136         -
        ...
  137         -
  138         -
  139         -
    def as_string_value(self) -> str:
  140         -
        """
  141         -
        Tries to convert the enum instance into [`StringValue`](crate::model::MyUnion::StringValue), extracting the inner [`String`](::std::string::String).
  142         -
        """
  143         -
        ...
  144         -
  145         -
  146         -
    def as_structure_value(self) -> json_rpc11.model.GreetingStruct:
  147         -
        """
  148         -
        Tries to convert the enum instance into [`StructureValue`](crate::model::MyUnion::StructureValue), extracting the inner [`GreetingStruct`](crate::model::GreetingStruct).
  149         -
        """
  150         -
        ...
  151         -
  152         -
  153         -
    def as_timestamp_value(self) -> json_rpc11.types.DateTime:
  154         -
        """
  155         -
        Tries to convert the enum instance into [`TimestampValue`](crate::model::MyUnion::TimestampValue), extracting the inner [`DateTime`](::aws_smithy_http_server_python::types::DateTime).
  156         -
        """
  157         -
        ...
  158         -
  159         -
  160         -
    @staticmethod
  161         -
    def blob_value(data: json_rpc11.types.Blob) -> MyUnion:
  162         -
        """
  163         -
        Creates a new union instance of [`BlobValue`](crate::model::MyUnion::BlobValue)
  164         -
        """
  165         -
        ...
  166         -
  167         -
  168         -
    @staticmethod
  169         -
    def boolean_value(data: bool) -> MyUnion:
  170         -
        """
  171         -
        Creates a new union instance of [`BooleanValue`](crate::model::MyUnion::BooleanValue)
  172         -
        """
  173         -
        ...
  174         -
  175         -
  176         -
    @staticmethod
  177         -
    def enum_value(data: json_rpc11.model.FooEnum) -> MyUnion:
  178         -
        """
  179         -
        Creates a new union instance of [`EnumValue`](crate::model::MyUnion::EnumValue)
  180         -
        """
  181         -
        ...
  182         -
  183         -
  184         -
    def is_blob_value(self) -> bool:
  185         -
        """
  186         -
        Returns true if this is a [`BlobValue`](crate::model::MyUnion::BlobValue).
  187         -
        """
  188         -
        ...
  189         -
  190         -
  191         -
    def is_boolean_value(self) -> bool:
  192         -
        """
  193         -
        Returns true if this is a [`BooleanValue`](crate::model::MyUnion::BooleanValue).
  194         -
        """
  195         -
        ...
  196         -
  197         -
  198         -
    def is_enum_value(self) -> bool:
  199         -
        """
  200         -
        Returns true if this is a [`EnumValue`](crate::model::MyUnion::EnumValue).
  201         -
        """
  202         -
        ...
  203         -
  204         -
  205         -
    def is_list_value(self) -> bool:
  206         -
        """
  207         -
        Returns true if this is a [`ListValue`](crate::model::MyUnion::ListValue).
  208         -
        """
  209         -
        ...
  210         -
  211         -
  212         -
    def is_map_value(self) -> bool:
  213         -
        """
  214         -
        Returns true if this is a [`MapValue`](crate::model::MyUnion::MapValue).
  215         -
        """
  216         -
        ...
  217         -
  218         -
  219         -
    def is_number_value(self) -> bool:
  220         -
        """
  221         -
        Returns true if this is a [`NumberValue`](crate::model::MyUnion::NumberValue).
  222         -
        """
  223         -
        ...
  224         -
  225         -
  226         -
    def is_string_value(self) -> bool:
  227         -
        """
  228         -
        Returns true if this is a [`StringValue`](crate::model::MyUnion::StringValue).
  229         -
        """
  230         -
        ...
  231         -
  232         -
  233         -
    def is_structure_value(self) -> bool:
  234         -
        """
  235         -
        Returns true if this is a [`StructureValue`](crate::model::MyUnion::StructureValue).
  236         -
        """
  237         -
        ...
  238         -
  239         -
  240         -
    def is_timestamp_value(self) -> bool:
  241         -
        """
  242         -
        Returns true if this is a [`TimestampValue`](crate::model::MyUnion::TimestampValue).
  243         -
        """
  244         -
        ...
  245         -
  246         -
  247         -
    @staticmethod
  248         -
    def list_value(data: typing.List[str]) -> MyUnion:
  249         -
        """
  250         -
        Creates a new union instance of [`ListValue`](crate::model::MyUnion::ListValue)
  251         -
        """
  252         -
        ...
  253         -
  254         -
  255         -
    @staticmethod
  256         -
    def map_value(data: typing.Dict[str, str]) -> MyUnion:
  257         -
        """
  258         -
        Creates a new union instance of [`MapValue`](crate::model::MyUnion::MapValue)
  259         -
        """
  260         -
        ...
  261         -
  262         -
  263         -
    @staticmethod
  264         -
    def number_value(data: int) -> MyUnion:
  265         -
        """
  266         -
        Creates a new union instance of [`NumberValue`](crate::model::MyUnion::NumberValue)
  267         -
        """
  268         -
        ...
  269         -
  270         -
  271         -
    @staticmethod
  272         -
    def string_value(data: str) -> MyUnion:
  273         -
        """
  274         -
        Creates a new union instance of [`StringValue`](crate::model::MyUnion::StringValue)
  275         -
        """
  276         -
        ...
  277         -
  278         -
  279         -
    @staticmethod
  280         -
    def structure_value(data: json_rpc11.model.GreetingStruct) -> MyUnion:
  281         -
        """
  282         -
        Creates a new union instance of [`StructureValue`](crate::model::MyUnion::StructureValue)
  283         -
        """
  284         -
        ...
  285         -
  286         -
  287         -
    @staticmethod
  288         -
    def timestamp_value(data: json_rpc11.types.DateTime) -> MyUnion:
  289         -
        """
  290         -
        Creates a new union instance of [`TimestampValue`](crate::model::MyUnion::TimestampValue)
  291         -
        """
  292         -
        ...
  293         -
  294         -
  295         -
class SimpleStruct:
  296         -
    value: typing.Optional[str]
  297         -
  298         -
    def __init__(self, value: typing.Optional[str] = ...) -> None:
  299         -
        ...
  300         -
  301         -
  302         -
class StructWithJsonName:
  303         -
    value: typing.Optional[str]
  304         -
  305         -
    def __init__(self, value: typing.Optional[str] = ...) -> None:
  306         -
        ...
  307         -
  308         -
  309         -
class ValidationExceptionField:
  310         -
    """
  311         -
    Describes one specific validation failure for an input member.
  312         -
    """
  313         -
  314         -
    message: str
  315         -
    """
  316         -
    A detailed description of the validation failure.
  317         -
    """
  318         -
  319         -
    path: str
  320         -
    """
  321         -
    A JSONPointer expression to the structure member whose value failed to satisfy the modeled constraints.
  322         -
    """
  323         -
  324         -
    def __init__(self, path: str, message: str) -> None:
  325         -
        ...
  326         -

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

@@ -1,0 +181,0 @@
    1         -
import json_rpc11.model
    2         -
import json_rpc11.types
    3         -
import typing
    4         -
    5         -
class ContentTypeParametersOutput:
    6         -
    def __init__(self) -> None:
    7         -
        ...
    8         -
    9         -
   10         -
class DatetimeOffsetsOutput:
   11         -
    datetime: typing.Optional[json_rpc11.types.DateTime]
   12         -
   13         -
    def __init__(self, datetime: typing.Optional[json_rpc11.types.DateTime] = ...) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class EmptyOperationOutput:
   18         -
    def __init__(self) -> None:
   19         -
        ...
   20         -
   21         -
   22         -
class EndpointOperationOutput:
   23         -
    def __init__(self) -> None:
   24         -
        ...
   25         -
   26         -
   27         -
class EndpointWithHostLabelOperationOutput:
   28         -
    def __init__(self) -> None:
   29         -
        ...
   30         -
   31         -
   32         -
class FractionalSecondsOutput:
   33         -
    datetime: typing.Optional[json_rpc11.types.DateTime]
   34         -
   35         -
    def __init__(self, datetime: typing.Optional[json_rpc11.types.DateTime] = ...) -> None:
   36         -
        ...
   37         -
   38         -
   39         -
class GreetingWithErrorsOutput:
   40         -
    greeting: typing.Optional[str]
   41         -
   42         -
    def __init__(self, greeting: typing.Optional[str] = ...) -> None:
   43         -
        ...
   44         -
   45         -
   46         -
class HostWithPathOperationOutput:
   47         -
    def __init__(self) -> None:
   48         -
        ...
   49         -
   50         -
   51         -
class JsonEnumsOutput:
   52         -
    foo_enum1: typing.Optional[json_rpc11.model.FooEnum]
   53         -
   54         -
    foo_enum2: typing.Optional[json_rpc11.model.FooEnum]
   55         -
   56         -
    foo_enum3: typing.Optional[json_rpc11.model.FooEnum]
   57         -
   58         -
    foo_enum_list: typing.Optional[typing.List[json_rpc11.model.FooEnum]]
   59         -
   60         -
    foo_enum_map: typing.Optional[typing.Dict[str, json_rpc11.model.FooEnum]]
   61         -
   62         -
    foo_enum_set: typing.Optional[typing.List[json_rpc11.model.FooEnum]]
   63         -
   64         -
    def __init__(self, foo_enum1: typing.Optional[json_rpc11.model.FooEnum] = ..., foo_enum2: typing.Optional[json_rpc11.model.FooEnum] = ..., foo_enum3: typing.Optional[json_rpc11.model.FooEnum] = ..., foo_enum_list: typing.Optional[typing.List[json_rpc11.model.FooEnum]] = ..., foo_enum_set: typing.Optional[typing.List[json_rpc11.model.FooEnum]] = ..., foo_enum_map: typing.Optional[typing.Dict[str, json_rpc11.model.FooEnum]] = ...) -> None:
   65         -
        ...
   66         -
   67         -
   68         -
class JsonUnionsOutput:
   69         -
    """
   70         -
    A shared structure that contains a single union member.
   71         -
    """
   72         -
   73         -
    contents: typing.Optional[json_rpc11.model.MyUnion]
   74         -
    """
   75         -
    A union with a representative set of types for members.
   76         -
    """
   77         -
   78         -
    def __init__(self, contents: typing.Optional[json_rpc11.model.MyUnion] = ...) -> None:
   79         -
        ...
   80         -
   81         -
   82         -
class KitchenSinkOperationOutput:
   83         -
    blob: typing.Optional[json_rpc11.types.Blob]
   84         -
   85         -
    boolean: typing.Optional[bool]
   86         -
   87         -
    double: typing.Optional[float]
   88         -
   89         -
    empty_struct: typing.Optional[json_rpc11.model.EmptyStruct]
   90         -
   91         -
    float: typing.Optional[float]
   92         -
   93         -
    httpdate_timestamp: typing.Optional[json_rpc11.types.DateTime]
   94         -
   95         -
    integer: typing.Optional[int]
   96         -
   97         -
    iso8601_timestamp: typing.Optional[json_rpc11.types.DateTime]
   98         -
   99         -
    json_value: typing.Optional[str]
  100         -
  101         -
    list_of_lists: typing.Optional[typing.List[typing.List[str]]]
  102         -
  103         -
    list_of_maps_of_strings: typing.Optional[typing.List[typing.Dict[str, str]]]
  104         -
  105         -
    list_of_strings: typing.Optional[typing.List[str]]
  106         -
  107         -
    list_of_structs: typing.Optional[typing.List[json_rpc11.model.SimpleStruct]]
  108         -
  109         -
    long: typing.Optional[int]
  110         -
  111         -
    map_of_lists_of_strings: typing.Optional[typing.Dict[str, typing.List[str]]]
  112         -
  113         -
    map_of_maps: typing.Optional[typing.Dict[str, typing.Dict[str, str]]]
  114         -
  115         -
    map_of_strings: typing.Optional[typing.Dict[str, str]]
  116         -
  117         -
    map_of_structs: typing.Optional[typing.Dict[str, json_rpc11.model.SimpleStruct]]
  118         -
  119         -
    recursive_list: typing.Optional[typing.List[json_rpc11.model.KitchenSink]]
  120         -
  121         -
    recursive_map: typing.Optional[typing.Dict[str, json_rpc11.model.KitchenSink]]
  122         -
  123         -
    recursive_struct: typing.Optional[json_rpc11.model.KitchenSink]
  124         -
  125         -
    simple_struct: typing.Optional[json_rpc11.model.SimpleStruct]
  126         -
  127         -
    string: typing.Optional[str]
  128         -
  129         -
    struct_with_json_name: typing.Optional[json_rpc11.model.StructWithJsonName]
  130         -
  131         -
    timestamp: typing.Optional[json_rpc11.types.DateTime]
  132         -
  133         -
    unix_timestamp: typing.Optional[json_rpc11.types.DateTime]
  134         -
  135         -
    def __init__(self, blob: typing.Optional[json_rpc11.types.Blob] = ..., boolean: typing.Optional[bool] = ..., double: typing.Optional[float] = ..., empty_struct: typing.Optional[json_rpc11.model.EmptyStruct] = ..., float: typing.Optional[float] = ..., httpdate_timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., integer: typing.Optional[int] = ..., iso8601_timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., json_value: typing.Optional[str] = ..., list_of_lists: typing.Optional[typing.List[typing.List[str]]] = ..., list_of_maps_of_strings: typing.Optional[typing.List[typing.Dict[str, str]]] = ..., list_of_strings: typing.Optional[typing.List[str]] = ..., list_of_structs: typing.Optional[typing.List[json_rpc11.model.SimpleStruct]] = ..., long: typing.Optional[int] = ..., map_of_lists_of_strings: typing.Optional[typing.Dict[str, typing.List[str]]] = ..., map_of_maps: typing.Optional[typing.Dict[str, typing.Dict[str, str]]] = ..., map_of_strings: typing.Optional[typing.Dict[str, str]] = ..., map_of_structs: typing.Optional[typing.Dict[str, json_rpc11.model.SimpleStruct]] = ..., recursive_list: typing.Optional[typing.List[json_rpc11.model.KitchenSink]] = ..., recursive_map: typing.Optional[typing.Dict[str, json_rpc11.model.KitchenSink]] = ..., recursive_struct: typing.Optional[json_rpc11.model.KitchenSink] = ..., simple_struct: typing.Optional[json_rpc11.model.SimpleStruct] = ..., string: typing.Optional[str] = ..., struct_with_json_name: typing.Optional[json_rpc11.model.StructWithJsonName] = ..., timestamp: typing.Optional[json_rpc11.types.DateTime] = ..., unix_timestamp: typing.Optional[json_rpc11.types.DateTime] = ...) -> None:
  136         -
        ...
  137         -
  138         -
  139         -
class NullOperationOutput:
  140         -
    string: typing.Optional[str]
  141         -
  142         -
    def __init__(self, string: typing.Optional[str] = ...) -> None:
  143         -
        ...
  144         -
  145         -
  146         -
class OperationWithOptionalInputOutputOutput:
  147         -
    value: typing.Optional[str]
  148         -
  149         -
    def __init__(self, value: typing.Optional[str] = ...) -> None:
  150         -
        ...
  151         -
  152         -
  153         -
class PutAndGetInlineDocumentsOutput:
  154         -
    inline_document: typing.Optional[json_rpc11.types.Document]
  155         -
  156         -
    def __init__(self, inline_document: typing.Optional[json_rpc11.types.Document] = ...) -> None:
  157         -
        ...
  158         -
  159         -
  160         -
class PutWithContentEncodingOutput:
  161         -
    def __init__(self) -> None:
  162         -
        ...
  163         -
  164         -
  165         -
class SimpleScalarPropertiesOutput:
  166         -
    double_value: typing.Optional[float]
  167         -
  168         -
    float_value: typing.Optional[float]
  169         -
  170         -
    def __init__(self, float_value: typing.Optional[float] = ..., double_value: typing.Optional[float] = ...) -> None:
  171         -
        ...
  172         -
  173         -
  174         -
class SparseNullsOperationOutput:
  175         -
    sparse_string_list: typing.Optional[typing.List[typing.Optional[str]]]
  176         -
  177         -
    sparse_string_map: typing.Optional[typing.Dict[str, typing.Optional[str]]]
  178         -
  179         -
    def __init__(self, sparse_string_list: typing.Optional[typing.List[typing.Optional[str]]] = ..., sparse_string_map: typing.Optional[typing.Dict[str, typing.Optional[str]]] = ...) -> None:
  180         -
        ...
  181         -

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

@@ -1,0 +27,0 @@
    1         -
import typing
    2         -
    3         -
class PySocket:
    4         -
    """
    5         -
    Socket implementation that can be shared between multiple Python processes.
    6         -
    7         -
    Python cannot handle true multi-threaded applications due to the [GIL],
    8         -
    often resulting in reduced performance and only one core used by the application.
    9         -
    To work around this, Python web applications usually create a socket with
   10         -
    SO_REUSEADDR and SO_REUSEPORT enabled that can be shared between multiple
   11         -
    Python processes, allowing you to maximize performance and use all available
   12         -
    computing capacity of the host.
   13         -
   14         -
    [GIL]: https://wiki.python.org/moin/GlobalInterpreterLock
   15         -
    """
   16         -
   17         -
    def try_clone(self) -> PySocket:
   18         -
        """
   19         -
        Clone the inner socket allowing it to be shared between multiple
   20         -
        Python processes.
   21         -
        """
   22         -
        ...
   23         -
   24         -
   25         -
    def __init__(self, address: str, port: int, backlog: typing.Optional[int] = ...) -> None:
   26         -
        ...
   27         -

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

@@ -1,0 +10,0 @@
    1         -
import pathlib
    2         -
    3         -
class TlsConfig:
    4         -
    """
    5         -
    PyTlsConfig represents TLS configuration created from Python.
    6         -
    """
    7         -
    8         -
    def __init__(self, key_path: pathlib.Path, cert_path: pathlib.Path, reload_secs: int = ...) -> None:
    9         -
        ...
   10         -

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

@@ -1,0 +209,0 @@
    1         -
import typing
    2         -
    3         -
class Blob:
    4         -
    """
    5         -
    Python Wrapper for [aws_smithy_types::Blob].
    6         -
    """
    7         -
    8         -
    data: bytes
    9         -
    """
   10         -
    Python getter for the `Blob` byte array.
   11         -
    """
   12         -
   13         -
    def __init__(self, input: bytes) -> None:
   14         -
        ...
   15         -
   16         -
   17         -
class ByteStream:
   18         -
    """
   19         -
    Python Wrapper for [aws_smithy_types::byte_stream::ByteStream].
   20         -
   21         -
    ByteStream provides misuse-resistant primitives to make it easier to handle common patterns with streaming data.
   22         -
   23         -
    On the Rust side, The Python implementation wraps the original [ByteStream](aws_smithy_types::byte_stream::ByteStream)
   24         -
    in a clonable structure and implements the [Stream](futures::stream::Stream) trait for it to
   25         -
    allow Rust to handle the type transparently.
   26         -
   27         -
    On the Python side both sync and async iterators are exposed by implementing `__iter__()` and `__aiter__()` magic methods,
   28         -
    which allows to just loop over the stream chunks.
   29         -
   30         -
    ### Example of async streaming:
   31         -
   32         -
    ```python
   33         -
        stream = await ByteStream.from_path("/tmp/music.mp3")
   34         -
        async for chunk in stream:
   35         -
            print(chunk)
   36         -
    ```
   37         -
   38         -
    ### Example of sync streaming:
   39         -
   40         -
    ```python
   41         -
        stream = ByteStream.from_stream_blocking("/tmp/music.mp3")
   42         -
        for chunk in stream:
   43         -
            print(chunk)
   44         -
    ```
   45         -
   46         -
    The main difference between the two implementations is that the async one is scheduling the Python coroutines as Rust futures,
   47         -
    effectively maintaining the asyncronous behavior that Rust exposes, while the sync one is blocking the Tokio runtime to be able
   48         -
    to await one chunk at a time.
   49         -
   50         -
    The original Rust [ByteStream](aws_smithy_types::byte_stream::ByteStream) is wrapped inside a `Arc<Mutex>` to allow the type to be
   51         -
    [Clone] (required by PyO3) and to allow internal mutability, required to fetch the next chunk of data.
   52         -
    """
   53         -
   54         -
    @staticmethod
   55         -
    def from_path(path: str) -> typing.Awaitable[ByteStream]:
   56         -
        """
   57         -
        Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, forcing
   58         -
        Python to await this coroutine.
   59         -
        """
   60         -
        ...
   61         -
   62         -
   63         -
    @staticmethod
   64         -
    def from_path_blocking(path: str) -> ByteStream:
   65         -
        """
   66         -
        Create a new [ByteStream](aws_smithy_types::byte_stream::ByteStream) from a path, without
   67         -
        requiring Python to await this method.
   68         -
   69         -
        **NOTE:** This method will block the Rust event loop when it is running.
   70         -
        """
   71         -
        ...
   72         -
   73         -
   74         -
    def __init__(self, input: bytes) -> None:
   75         -
        ...
   76         -
   77         -
   78         -
class DateTime:
   79         -
    """
   80         -
    Python Wrapper for [aws_smithy_types::date_time::DateTime].
   81         -
    """
   82         -
   83         -
    def as_nanos(self) -> int:
   84         -
        """
   85         -
        Returns the number of nanoseconds since the Unix epoch that this `DateTime` represents.
   86         -
        """
   87         -
        ...
   88         -
   89         -
   90         -
    def as_secs_f64(self) -> float:
   91         -
        """
   92         -
        Returns the `DateTime` value as an `f64` representing the seconds since the Unix epoch.
   93         -
        """
   94         -
        ...
   95         -
   96         -
   97         -
    @staticmethod
   98         -
    def from_fractional_secs(epoch_seconds: int, fraction: float) -> DateTime:
   99         -
        """
  100         -
        Creates a `DateTime` from a number of seconds and a fractional second since the Unix epoch.
  101         -
        """
  102         -
        ...
  103         -
  104         -
  105         -
    @staticmethod
  106         -
    def from_millis(epoch_millis: int) -> DateTime:
  107         -
        """
  108         -
        Creates a `DateTime` from a number of milliseconds since the Unix epoch.
  109         -
        """
  110         -
        ...
  111         -
  112         -
  113         -
    @staticmethod
  114         -
    def from_nanos(epoch_nanos: int) -> DateTime:
  115         -
        """
  116         -
        Creates a `DateTime` from a number of nanoseconds since the Unix epoch.
  117         -
        """
  118         -
        ...
  119         -
  120         -
  121         -
    @staticmethod
  122         -
    def from_secs(epoch_seconds: int) -> DateTime:
  123         -
        """
  124         -
        Creates a `DateTime` from a number of seconds since the Unix epoch.
  125         -
        """
  126         -
        ...
  127         -
  128         -
  129         -
    @staticmethod
  130         -
    def from_secs_and_nanos(seconds: int, subsecond_nanos: int) -> DateTime:
  131         -
        """
  132         -
        Creates a `DateTime` from a number of seconds and sub-second nanos since the Unix epoch.
  133         -
        """
  134         -
        ...
  135         -
  136         -
  137         -
    @staticmethod
  138         -
    def from_secs_f64(epoch_seconds: float) -> DateTime:
  139         -
        """
  140         -
        Creates a `DateTime` from an `f64` representing the number of seconds since the Unix epoch.
  141         -
        """
  142         -
        ...
  143         -
  144         -
  145         -
    @staticmethod
  146         -
    def from_str(s: str, format: Format) -> DateTime:
  147         -
        """
  148         -
        Parses a `DateTime` from a string using the given `format`.
  149         -
        """
  150         -
        ...
  151         -
  152         -
  153         -
    def has_subsec_nanos(self) -> bool:
  154         -
        """
  155         -
        Returns true if sub-second nanos is greater than zero.
  156         -
        """
  157         -
        ...
  158         -
  159         -
  160         -
    @staticmethod
  161         -
    def read(format: Format, delim: str) -> typing.Tuple[DateTime, str]:
  162         -
        """
  163         -
        Read 1 date of `format` from `s`, expecting either `delim` or EOF.
  164         -
  165         -
        TODO(PythonTyping): How do we represent `char` in Python?
  166         -
        """
  167         -
        ...
  168         -
  169         -
  170         -
    def secs(self) -> int:
  171         -
        """
  172         -
        Returns the epoch seconds component of the `DateTime`.
  173         -
        """
  174         -
        ...
  175         -
  176         -
  177         -
    def subsec_nanos(self) -> int:
  178         -
        """
  179         -
        Returns the sub-second nanos component of the `DateTime`.
  180         -
        """
  181         -
        ...
  182         -
  183         -
  184         -
    def to_millis(self) -> int:
  185         -
        """
  186         -
        Converts the `DateTime` to the number of milliseconds since the Unix epoch.
  187         -
        """
  188         -
        ...
  189         -
  190         -
  191         -
class Format:
  192         -
    """
  193         -
    Formats for representing a `DateTime` in the Smithy protocols.
  194         -
    """
  195         -
  196         -
    DateTime: Format
  197         -
    """
  198         -
    Formats for representing a `DateTime` in the Smithy protocols.
  199         -
    """
  200         -
  201         -
    EpochSeconds: Format
  202         -
    """
  203         -
    Formats for representing a `DateTime` in the Smithy protocols.
  204         -
    """
  205         -
  206         -
    HttpDate: Format
  207         -
    """
  208         -
    Formats for representing a `DateTime` in the Smithy protocols.
  209         -
    """