-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JsonName
ignored in examples when generating swagger docs
#148
Comments
JsonName
ignored when generating swagger docsJsonName
ignored in examples when generating swagger docs
@ShahOdin, thank you for transferring the issue. The The bad news is that, though it may not seem like it, this issue is extremely complex. The problem is sort of tied to your end note :
It is important to remember that Smithy is a protocol agnostic IDL. Therefore, the goal of the examples trait It was not designed to be used in openapi, and it's us (the maintainers of smithy4s and alloy) who were overzealous in trying to make use of it in the context of openapi. I think we were wrong, because taking the protocol-agnostic representation and turning it into a protocol-specific representation (like It would be possible for us to solve it at run-time (with the smithy4s constructs), and although this may be desirable in some aspects, it'd take us a fair amount of work to transition from a build-time solution to a run-time solution, and we don't currently have the bandwidth to do so. Where does that leave us ?I think the best course of action would be for us to :
The trade-off being that :
Regarding your question :
Well my reply hint at it, but considering smithy is a protocol-agnostic IDL, it is extremely unlikely that AWS will change the examples trait. |
Thank you so much for the in depth response!
purely from a user's point of view, I'd prefer a structure/Json format as input. I understand that internally you'd probably not want to parse it as a structure. fwiw, I have decided to drop the discrepency between What I would suggest is making this issue more explicit in the guides etc. perhaps here? https://disneystreaming.github.io/smithy4s/docs/protocols/simple-rest-json/overview |
Well the thing is that if we put something in place, we'd likely want to re-use it for other serialisations than json, so even if the smithy json-looking "node" (that's what they're called btw) seems like a good idea, I don't think it actually is ... Anyway, we'll give it a think when we find the time (it may not be for a while though, we're pretty swamped with more urgent stuff at work). If you want to take a go at it, I'm happy to give some guidance.
Good point, I'll give it a think. Thanks for the suggestion. |
If a structure member has a custom
@JsonName
:the generated swagger doc for the above service would ignore the
@JsonName
and usemessage
instead ofmsg
: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 bysmithy4s.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 thanmsg
, 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? 🤔The text was updated successfully, but these errors were encountered: