Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

## Unreleased

## v0.6.0

### Breaking Changes

* Generated operation outputs and modeled errors now reserve a
`response_metadata` attribute, carrying the request ID, extended request ID,
and HTTP status code of the response that produced them. A modeled member
named `responseMetadata` on an output or error is now generated as
`response_metadata_` to avoid the collision; only the Python attribute name
changes, not the wire representation.

## v0.5.0

### Breaking Changes
Expand Down
161 changes: 161 additions & 0 deletions codegen-output/aws-json-1-0/src/awsjson10/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from smithy_core.deserializers import ShapeDeserializer
from smithy_core.documents import Document, TypeRegistry
from smithy_core.exceptions import ModeledError, SerializationError
from smithy_core.response import EMPTY_RESPONSE_METADATA, ResponseMetadata
from smithy_core.schemas import APIOperation, Schema
from smithy_core.serializers import ShapeSerializer
from smithy_core.shapes import ShapeID
Expand Down Expand Up @@ -256,6 +257,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class ContentTypeParametersOutput:
"""Dataclass for ContentTypeParametersOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_CONTENT_TYPE_PARAMETERS_OUTPUT, self)

Expand Down Expand Up @@ -827,6 +838,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class EmptyInputAndEmptyOutputOutput:
"""Dataclass for EmptyInputAndEmptyOutputOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_EMPTY_INPUT_AND_EMPTY_OUTPUT_OUTPUT, self)

Expand Down Expand Up @@ -895,6 +916,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class EndpointOperationOutput:
"""Dataclass for EndpointOperationOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_ENDPOINT_OPERATION_OUTPUT, self)

Expand Down Expand Up @@ -976,6 +1007,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class EndpointWithHostLabelOperationOutput:
"""Dataclass for EndpointWithHostLabelOperationOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_ENDPOINT_WITH_HOST_LABEL_OPERATION_OUTPUT, self)

Expand Down Expand Up @@ -1088,6 +1129,16 @@ class GreetingWithErrorsOutput:

greeting: str | None = None

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_GREETING_WITH_ERRORS_OUTPUT, self)

Expand Down Expand Up @@ -1209,6 +1260,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class HostWithPathOperationOutput:
"""Dataclass for HostWithPathOperationOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_HOST_WITH_PATH_OPERATION_OUTPUT, self)

Expand Down Expand Up @@ -1667,6 +1728,16 @@ class JsonUnionsOutput:
contents: MyUnion | None = None
"""A union with a representative set of types for members."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_JSON_UNIONS_OUTPUT, self)

Expand Down Expand Up @@ -1741,6 +1812,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class NoInputAndNoOutputOutput:
"""Dataclass for NoInputAndNoOutputOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_NO_INPUT_AND_NO_OUTPUT_OUTPUT, self)

Expand Down Expand Up @@ -1809,6 +1890,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class NoInputAndOutputOutput:
"""Dataclass for NoInputAndOutputOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_NO_INPUT_AND_OUTPUT_OUTPUT, self)

Expand Down Expand Up @@ -1982,6 +2073,16 @@ class OperationWithDefaultsOutput:

zero_double: float = 0.0

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_OPERATION_WITH_DEFAULTS_OUTPUT, self)

Expand Down Expand Up @@ -2390,6 +2491,16 @@ class OperationWithNestedStructureOutput:

dialog_map: dict[str, Dialog] = field(default_factory=dict[str, Dialog])

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_OPERATION_WITH_NESTED_STRUCTURE_OUTPUT, self)

Expand Down Expand Up @@ -2570,6 +2681,16 @@ class OperationWithRequiredMembersOutput:

required_map: dict[str, str]

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_OPERATION_WITH_REQUIRED_MEMBERS_OUTPUT, self)

Expand Down Expand Up @@ -2841,6 +2962,16 @@ class OperationWithRequiredMembersWithDefaultsOutput:

required_int_enum: int = RequiredIntEnum(1)

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(
_SCHEMA_OPERATION_WITH_REQUIRED_MEMBERS_WITH_DEFAULTS_OUTPUT, self
Expand Down Expand Up @@ -3126,6 +3257,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class PutWithContentEncodingOutput:
"""Dataclass for PutWithContentEncodingOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_PUT_WITH_CONTENT_ENCODING_OUTPUT, self)

Expand Down Expand Up @@ -3196,6 +3337,16 @@ def _consumer(schema: Schema, de: ShapeDeserializer) -> None:
class QueryIncompatibleOperationOutput:
"""Dataclass for QueryIncompatibleOperationOutput structure."""

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_QUERY_INCOMPATIBLE_OPERATION_OUTPUT, self)

Expand Down Expand Up @@ -3294,6 +3445,16 @@ class SimpleScalarPropertiesOutput:

double_value: float | None = None

response_metadata: ResponseMetadata = field(
default=EMPTY_RESPONSE_METADATA, repr=False, compare=False
)
"""
Metadata about the response that produced this output. Use this to
recover the request identifiers a service's support team needs in order
to investigate a call. Members of the metadata are individually
optional.
"""

def serialize(self, serializer: ShapeSerializer):
serializer.write_struct(_SCHEMA_SIMPLE_SCALAR_PROPERTIES_OUTPUT, self)

Expand Down
Loading
Loading