Skip to content

Commit

Permalink
added a comment about adding fallback schema title
Browse files Browse the repository at this point in the history
  • Loading branch information
ghik committed Mar 12, 2024
1 parent 960291b commit b033abf
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ private[docs] class TSchemaToASchema(

private def addTitle(oschema: ASchema, tschema: TSchema[_]): ASchema = {
val fromAttr = tschema.attributes.get(Title.Attribute).map(_.value)
// The primary motivation for using schema name as fallback title is to improve Swagger UX with
// `oneOf` schemas in OpenAPI 3.1. See https://github.com/softwaremill/tapir/issues/3447 for details.
def fallback = tschema.name.map(fallbackSchemaTitle)
oschema.copy(title = fromAttr orElse fallback)
}
Expand Down

0 comments on commit b033abf

Please sign in to comment.