Skip to content

list with @sparse trait fails code generation with trait AsRef<str> is not implemented for Option<Type> #4327

@diegotry

Description

@diegotry

I have a list definition:

@sparse
list ExecutionStatusList {
    member: ExecutionStatus
}

where execution status is an enum:

enum ExecutionStatus {
    RUNNING
    SUCCEEDED
    FAILED
    TIMED_OUT
    STOPPED
}

when I tried to build, it fails with:

error[E0277]: the trait bound `Option<ExecutionStatus>: AsRef<str>` is not satisfied
   --> amzn-(..)client/src/operation/list_(...).rs:203:97
    |
203 | ...                   query.push_kv("StatusFilter", &::aws_smithy_http::query::fmt_string(inner_5));
    |                                                      ------------------------------------ ^^^^^^^ the trait `AsRef<str>` is not implemented for `Option<ExecutionStatus>`
    |                                                      |
    |                                                      required by a bound introduced by this call 

My assumption is that, when I moved to sparse lists (which accepts 'null'/'Optional'), the generated code didn't do well with it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions