Skip to content

JsonName ignored in examples when generating swagger docs #148

Open
@ShahOdin

Description

@ShahOdin

If a structure member has a custom @JsonName:

$version: "2.0"
namespace example.hello
operation Hello {
    output: Greeting
}
structure Greeting {
    @required
    @jsonName("msg")
    message: String
}
apply Hello @examples([
    {
        title: "My name is Jeff"
        output: {
            message: "Hello Jeff"
        }
    }
])

the generated swagger doc for the above service would ignore the @JsonName and use message instead of msg:

Screenshot 2024-03-08 at 01 46 56

I think this is wrong. Smithy docs mention useJsonName which might be of relevance but I couldn't find a way of setting that in the interface provided by smithy4s.http4s.swagger.docs.

Also note that in my example, I had to provide the output example as a smithy structure rather than a json. ie {message: "Hello Jeff"} rather than msg, which I'd argue, is a little counter intuitive for the reader. I understand this is perhaps one for smithy but do we know if it Would be possible to specify examples in json rather than smithy structures? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions