generated from amazon-archives/__template_Apache-2.0
-
Couldn't load subscription status.
- Fork 220
Closed
Labels
bugSomething isn't workingSomething isn't workingconstraint-traitshigh-priorityHigh priority issueHigh priority issueserverRust server SDKRust server SDK
Milestone
Description
Minimal reproducer:
$version: "1.0"
namespace com.amazonaws.simple
use aws.protocols#restJson1
use smithy.framework#ValidationException
@restJson1
service SimpleService {
operations: [
Operation
]
}
@http(uri: "/operation", method: "POST")
operation Operation {
//input: KeyModesOfUse // This works fine.
input: OperationInput
errors: [ValidationException]
}
structure OperationInput {
@required
KeyModesOfUse: KeyModesOfUse
}
structure KeyModesOfUse {
Encrypt: PrimitiveBoolean
}The issue is largely within these functions:
Using the example above:
OperationInputis correctly detected as constrained because of@requiredand because its member's target,KeyModesOfUse, reaches thePrimitiveBooleanconstrained shape, since it is not optional (note thatPrimitiveBooleanhas@default(false)in the prelude).
- However, when rendering the constraint violations for the
KeyModesOfUsestructure, the member is not detected as constrained: there is no arm inisDirectlyConstrainedthat matches the shape's type (theBooleanShapeJava class), so we go through theelsebranch.
So this results in the constraint violation for OperationInput containing a member pointing to the constraint violation for KeyModesOfUse, but the latter is never rendered!
error[E0412]: cannot find type `ConstraintViolation` in module `crate::model::key_modes_of_use`
--> simple/rust-server-codegen/src/input.rs:27:55
|
27 | KeyModesOfUse(crate::model::key_modes_of_use::ConstraintViolation),
| ^^^^^^^^^^^^^^^^^^^ not found in `crate::model::key_modes_of_use`
|
help: consider importing one of these items
|
19 | use crate::error::validation_exception::ConstraintViolation;
|
19 | use crate::model::validation_exception_field::ConstraintViolation;
|
help: if you import `ConstraintViolation`, refer to it directly
|
27 - KeyModesOfUse(crate::model::key_modes_of_use::ConstraintViolation),
27 + KeyModesOfUse(ConstraintViolation),
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingconstraint-traitshigh-priorityHigh priority issueHigh priority issueserverRust server SDKRust server SDK
Type
Projects
Status
Done