smithy-lang / smithy

Smithy is a protocol-agnostic interface definition language and set of tools for generating clients, servers, and documentation for any programming language.
https://smithy.io
Apache License 2.0
1.7k stars 201 forks source link

Can't provide error examples for an erorr applied at service level, as opposed to operation level #2299

Closed ShahOdin closed 3 weeks ago

ShahOdin commented 1 month ago

if I have:

operation GetFoo {
    errors: [MyError1]
}

service MtService {
    operations: [
        GetFoo
    ]
    errors: [
        MyError2
    ]
}

I can happily provide an example for MyError1:

apply GetFoo @examples([
    {
        title: "MyError1"
        error: {
            shapeId: MyError1
            content: {...}
        }
    }
])

but I can't do it for MyError2 this validation stops me from doing so:

https://github.com/smithy-lang/smithy/blob/0f2ddf70dc764206dd1e12e64d7555da251a947a/smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/ExamplesTraitValidator.java#L78-L86

is this an oversight? related: https://github.com/smithy-lang/smithy/issues/894