From fda19d6da550542d1e83bcbb90c9e15612e92e1f Mon Sep 17 00:00:00 2001 From: JordonPhillips Date: Tue, 10 Dec 2024 14:13:38 +0100 Subject: [PATCH] Write error trait to schema This removes the error trait from the filter that filters out what traits are written into the schema. This trait is needed when serializing exceptions, as there is no access to the actual value when the structure is being created. --- .../amazon/smithy/python/codegen/SchemaGenerator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/smithy-python-codegen/src/main/java/software/amazon/smithy/python/codegen/SchemaGenerator.java b/codegen/smithy-python-codegen/src/main/java/software/amazon/smithy/python/codegen/SchemaGenerator.java index 105cd77ec..8ff44ccad 100644 --- a/codegen/smithy-python-codegen/src/main/java/software/amazon/smithy/python/codegen/SchemaGenerator.java +++ b/codegen/smithy-python-codegen/src/main/java/software/amazon/smithy/python/codegen/SchemaGenerator.java @@ -21,7 +21,6 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.traits.DocumentationTrait; import software.amazon.smithy.model.traits.EnumTrait; -import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.model.traits.UnitTypeTrait; import software.amazon.smithy.model.traits.synthetic.SyntheticEnumTrait; import software.amazon.smithy.utils.CaseUtils; @@ -36,9 +35,10 @@ final class SchemaGenerator implements Consumer { private static final Logger LOGGER = Logger.getLogger(SchemaGenerator.class.getName()); - // Filter out traits that already exist as generated parts of the class, such as documentation. + // Filter out traits that would overly bloat the definition, which are already part of the + // class, such as documentation. private static final Set DEFAULT_TRAIT_FILTER = Set.of( - DocumentationTrait.ID, ErrorTrait.ID, EnumTrait.ID, SyntheticEnumTrait.ID + DocumentationTrait.ID, EnumTrait.ID, SyntheticEnumTrait.ID ); private static final Symbol UNIT_SYMBOL = Symbol.builder()