Customize Schema Name of Generic Case Classes

Is it possible to customize the name of an auto-derived schema for a generic case class? Example:

case class Foo[T](t: T)

case class Bar()[Foo[Bar]])

Generating OpenAPI docs on this endpoint will result in a schema with the name Foo_Bar, whereas I might want its name to actually be BarFoo or any other arbitrary name.

Thanks in advance for any help

You should be able to do something like:


Or suing an annotation:

case class Foo[T](t: T)

Though this sets is globally for all usages.

1 Like

Is there any way to set this as a different name for each instance?

Yes, using the first approach - you simply modify this at usage-site. Annotations are global.

1 Like