File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,14 @@ fun Shape.isDirectlyConstrained(symbolProvider: SymbolProvider): Boolean =
103103 }
104104
105105/* *
106- * See [Shape.isDirectlyConstrained]
106+ * Finds shapes that are directly constrained in validation phase, which means the shape is a:
107+ * - [StructureShape] with a required member that does not have a non-null default
108+ * - [EnumShape]
109+ * - [IntEnumShape]
110+ * - [MemberShape] that is required and does not have a non-null default
107111 *
108- * We use this to check for constrained shapes in validation phase because the [SymbolProvider] has not yet been created
112+ * We use this rather than [Shape.isDirectlyConstrained] to check for constrained shapes in validation phase because
113+ * the [SymbolProvider] has not yet been created
109114 */
110115fun Shape.isDirectlyConstrainedForValidation (): Boolean =
111116 when (this ) {
@@ -160,9 +165,10 @@ fun Shape.canReachConstrainedShape(
160165 }
161166
162167/* *
163- * See [Shape.canReachConstrainedShape]
168+ * Whether this shape (or the shape's target for [MemberShape]s) can reach constrained shapes for validations.
164169 *
165- * We use this to check for constrained shapes in validation phase because the [SymbolProvider] has not yet been created
170+ * We use this rather than [Shape.canReachConstrainedShape] to check for constrained shapes in validation phase because
171+ * the [SymbolProvider] has not yet been created
166172 */
167173fun Shape.canReachConstrainedShapeForValidation (model : Model ): Boolean =
168174 if (this is MemberShape ) {
Original file line number Diff line number Diff line change @@ -3,8 +3,10 @@ package software.amazon.smithy.rust.codegen.server.smithy.util
33import software.amazon.smithy.model.shapes.MemberShape
44import software.amazon.smithy.rust.codegen.server.smithy.traits.ValidationMessageTrait
55
6- // Helper function to determine if this [MemberShape] is a validation message either explicitly with the
7- // @validationMessage trait or implicitly because it is named "message"
6+ /* *
7+ * Helper function to determine if this [MemberShape] is a validation message either explicitly with the
8+ * @validationMessage trait or implicitly because it is named "message"
9+ */
810fun MemberShape.isValidationMessage (): Boolean {
911 return this .hasTrait(ValidationMessageTrait .ID ) || this .memberName == " message"
1012}
You can’t perform that action at this time.
0 commit comments