Description
TL;DR - Can we use title
for the inlined object generated as part of the oneOf
union strategy?
Disclaimer: I am opening my first issue for Smithy.
I recently started using Smithy and primarily generate Open API specifications. For context, I use Redocly for documentation generation. When using Smithy's union type, I noticed that the generated Open API spec using inline types within the oneOf
attribute (default strategy). This results in the same display issue as mentioned in this Redocly/redoc issue, but is unrelated w.r.t. problem/solutions (I think). It showcases my desired outcome (display) though.
Glancing through the source code, I arrived at JsonSchemaShapeVisitor
. I believe we would add title in this code block. Due to the simple fix (as I see it), I can contribute the change. However, I want to confirm this solution is "correct."
- I understand
title
to be descriptive in nature, but are there other consequences/implications of this attribute? I could not understand more from the Swagger documentation though. - I propose to add the member name as the title. This guarantee uniqueness (within the
oneOf
) and makes the most sense when reading: "One of foo, bar, or baz" for the following union.union MyUnion { foo: String, bar: String, baz: String, }
- I have not looked at tests yet, but I expect I would add to an existing case or create a title-specific one.
- I believe this change should be backwards compatible given the nature of title (related to my first question in this list), but I would like confirmation.
Thanks in advance!